rygar Posted April 24, 2018 Share Posted April 24, 2018 (edited) Hello, I'm trying to figure out how to solve the out of stock combination products when opening the product page. Now when the customer is on the product page and if the default variant-product is out of stock it doesn't change automatically to the available stock which adds some confusion for some customers that this product including the variant products is as well out of stock! Can anybody help resolving this issue? Edited April 24, 2018 by rygar (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted May 25, 2018 Share Posted May 25, 2018 Which PS version are you using? I'm on PS1.6.1.10 and soon I would like to update to PS1.7... This feature hasn't yet been implemented also on PS1.7? Link to comment Share on other sites More sharing options...
rygar Posted May 30, 2018 Author Share Posted May 30, 2018 @Darkf3d3 im using latest 1.7.3 release.. so nope this feature is not implemented as yet Link to comment Share on other sites More sharing options...
eukaonly Posted July 12, 2018 Share Posted July 12, 2018 Hello, I've found some way to do it (PS 1.6) via php and mysql. Simple script to change default attribute, for testing change line: $st = $db->prepare("select * from ps_product_attribute WHERE quantity=0 and default_on=1"); to: $st = $db->prepare("select * from ps_product_attribute WHERE quantity=0 and default_on=1 and id_product=_SOME_ID_"); //connect with mysql try { $db = new PDO(_HERE_YOUR_PARAMETERS); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $e) { die('ERR database'); } //get defaults attributes without quantity $st = $db->prepare("select * from ps_product_attribute WHERE quantity=0 and default_on=1"); try { $st->execute(); } catch ( Exception $e ) { die($e); } $defki = $st->fetchAll(PDO::FETCH_ASSOC); //for each default attribute without quantity foreach ($defki as $def) { //check if product has some attribute with quantity>0 $st = $db->prepare("select * from ps_product_attribute WHERE quantity>0 and id_product=:idp LIMIT 1"); $st->bindValue(':idp',$def['id_product']); try { $st->execute(); } catch ( Exception $e ) { die($e); } $jest = $st->fetch(PDO::FETCH_ASSOC); //if there is product with quantity if ($jest['id_product_attribute'] > 0) { //update old default_on to NULL in ps_product_attribute and ps_product_attribute_shop $st = $db->prepare("update ps_product_attribute set default_on=NULL where id_product_attribute=:idpa"); $st->bindValue(':idpa',$def['id_product_attribute']); $st = $db->prepare("update ps_product_attribute_shop set default_on=NULL where id_product_attribute=:idpa"); $st->bindValue(':idpa',$def['id_product_attribute']); try { $st->execute(); } catch ( Exception $e ) { die($e); } //update default_on to 1 in ps_product_attribute and in ps_product_attribute_shop for attribute with quantity>0 $st = $db->prepare("update ps_product_attribute set default_on=1 where id_product_attribute=:idpa"); $st->bindValue(':idpa',$jest['id_product_attribute']); $st = $db->prepare("update ps_product_attribute_shop set default_on=1 where id_product_attribute=:idpa"); $st->bindValue(':idpa',$jest['id_product_attribute']); try { $st->execute(); } catch ( Exception $e ) { die($e); } } } Link to comment Share on other sites More sharing options...
tomerg3 Posted December 30, 2019 Share Posted December 30, 2019 Stay tuned for a free module to handle this automatically, should be released in the next couple of days. Link to comment Share on other sites More sharing options...
tomerg3 Posted January 1, 2020 Share Posted January 1, 2020 This free module has been released, more information at https://www.prestashop.com/forums/topic/1011838-free-module-out-of-stock-combination-change/ 1 Link to comment Share on other sites More sharing options...
kossrlive Posted March 30, 2020 Share Posted March 30, 2020 Thanks a lot. Could you please add cron support. ))) This issue often firing when importing large catalogs from ERP`s, Accounting softwares, direct DB uploads. So it will be very useful for many users i think. Products Uploaded, Then Runs Cron-Task. Like at Installation step. Scanning all products. Link to comment Share on other sites More sharing options...
fredecs Posted September 24, 2020 Share Posted September 24, 2020 This module have saved my life! hehehe Thanks man Link to comment Share on other sites More sharing options...
tomerg3 Posted September 25, 2020 Share Posted September 25, 2020 17 hours ago, fredecs said: This module have saved my life! hehehe Thanks man You're welcome! Link to comment Share on other sites More sharing options...
Guest Posted September 28, 2020 Share Posted September 28, 2020 (edited) . Edited July 26, 2021 by Guest (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted March 25, 2021 Share Posted March 25, 2021 Do you know if this feature has been implemented on last Prestashop version (1.7.7.2)? 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