AcidLava Posted January 16 Share Posted January 16 Hello, I'm looking for a way to exclude out of stock produts from the native cross selling module. I want to keep these products displayed in category product lists only. Thanks, Regards. Link to comment Share on other sites More sharing options...
Daresh Posted January 16 Share Posted January 16 Hello, elsewhere you said that you are setting visibility for out of stock products to `none` so you can try to modify the PHP code of the module changing: AND product_shop.active = 1 to: AND product_shop.active = 1 AND product_shop.visibility != \'none\' Of course to make it correctly, it should be done with a module override, but for first testing you can change it directly in the module and see if it works. Link to comment Share on other sites More sharing options...
AcidLava Posted January 16 Author Share Posted January 16 Hello, I tried but out of stock products still display. $order_products = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT od.product_id FROM ' . _DB_PREFIX_ . 'order_detail od LEFT JOIN ' . _DB_PREFIX_ . 'product p ON (p.id_product = od.product_id) ' . Shop::addSqlAssociation('product', 'p') . $sql_groups_join . ' WHERE od.id_order IN (' . $list . ') AND od.product_id NOT IN (' . $list_product_ids . ') AND product_shop.visibility IN (\'both\',\'catalog\') AND product_shop.active = 1 AND product_shop.visibility != \'none\' ' . $sql_groups_where . ' ORDER BY RAND() LIMIT ' . (int) Configuration::get('CROSSSELLING_NBR') ); } Link to comment Share on other sites More sharing options...
AcidLava Posted January 17 Author Share Posted January 17 Up. Link to comment Share on other sites More sharing options...
Daresh Posted January 17 Share Posted January 17 I just noticed that the is already that line there: AND product_shop.visibility IN (\'both\',\'catalog\') AND product_shop.visibility IN (\'both\',\'catalog\') So no changes should be required as long as your out of stock products have visibility set to 'none', so you need to make sure they do. Link to comment Share on other sites More sharing options...
AcidLava Posted January 18 Author Share Posted January 18 Hello, I want to keep the out of stock product displayed in categories list. I use your module for this. But still, I want to remove them from cross selling module. Link to comment Share on other sites More sharing options...
Daresh Posted January 18 Share Posted January 18 So try to change: AND product_shop.visibility IN (\'both\',\'catalog\') to AND product_shop.visibility IN (\'both\') Link to comment Share on other sites More sharing options...
AcidLava Posted January 18 Author Share Posted January 18 It still don't work. Link to comment Share on other sites More sharing options...
Daresh Posted January 26 Share Posted January 26 After this change, a product with its visibility set to 'catalog' should be excluded from the cross-selling module. Please double-check by taking a product that is incorrectly displayed there and verifying its visibility setting. Link to comment Share on other sites More sharing options...
AcidLava Posted January 27 Author Share Posted January 27 Hello @Daresh, Yes, the out of stock product is set to 'Catalog only'. Stills appear in the cross selling list... With this code : AND product_shop.visibility IN (\'both\') Link to comment Share on other sites More sharing options...
AcidLava Posted January 27 Author Share Posted January 27 It's on Prestashop 8.1.7. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now