#205 Cross Sells loads inactive / trashed articles

Posted in ‘Technical Support / Bugs’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Adam Melcher on Thursday, 20 March 2025 14:40 UTC

Terry Harker

Using the cross sale products in the latest J2commerce version (4.0.12), I realised that all products are loaded regardless of their state. I found out that in $cross_sell_product->source, I can find all article information, so I found a workaround for this for the moment, but I think it's a bug.

Here is my workaround: in the template, in view_crossells.php, find this line:

foreach($this->cross_sells as $cross_sell_product):

and add the following inside the loop:

if($cross_sell_product->source->state !==1) continue;

 

 

Adam Melcher

Terry,

 

Thanks for the great feedback, I have already updated the product helper file to ensure the product's article is also published (not sure why it wasn't already checked in the past) which means you shouldn't need to use your additional check in the override once 4.0.13 is released.

 

Adam

Stay Updated

Subscribe for free and be the first to know about the latest features, updates, and new additions.