Jupiterr Posted October 1, 2014 Share Posted October 1, 2014 Hello, I'm having a problem with the combinations. The case is the following: 1. Add a product with 2 combinations and stock. 2. Sell all the stock from the first combination. 3. The product says "This product is no longer in stock with those attributes but is available with others." 4. Change to the other combination/make it default an the message is gone. The question here is: Is it possible to auto-switch the default combination to another one so the user doesn't see this message and always the products are "available"? I'm using Prestashop 1.6.0.9. Thanks in advance! 2 Link to comment Share on other sites More sharing options...
web-port.pl Posted November 9, 2014 Share Posted November 9, 2014 You must change SQL query in core of your prestashop. Need to make custom sql table with id of product and make some PHP development. Link to comment Share on other sites More sharing options...
walter.w Posted December 4, 2014 Share Posted December 4, 2014 Hello, I have the same problem! I was curious if someone has a clear description of the solution? Thanks in advance!! Link to comment Share on other sites More sharing options...
walter.w Posted December 4, 2014 Share Posted December 4, 2014 Hi there, Found a solution!! http://codecanyon.net/item/auto-hide-outofstock-products-and-more/8296754 Link to comment Share on other sites More sharing options...
Marius05 Posted September 23, 2016 Share Posted September 23, 2016 Hi! I've created this module for PS 1.6 When user confirm order: - auto-switch the default combination to another one if quantity of combination is great then 0. - module have option to deactivate product from store if product dont have any other combination with quantity great then 0. For more info send PM ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Salut! Am creeat acest modul pentru PS 1.6 Cand un user confirma comanda: - schimba automat atributul/combinatia de atribute default cu un altul in care cantitatea este mai mare decat 0 - are optiunea de a dezactiva produsul daca acesta nu mai are atribute/combinatii de atribute cu cantitate mai mare decat 0 Pentru alte detalii dati-mi un mesaj in PM. Link to comment Share on other sites More sharing options...
Attrexx Posted January 26, 2017 Share Posted January 26, 2017 Since this is a feature that should have been implemented in the PS core functionalities and for over 2 years NO solutions were given except 2 paid modules, I am going to SPAM all the threads that address this matter.I am sorry but it doesn't seem fair at all that such an important base feature is made available via paid module when it should have been rolled out in a PS update long time ago I've seen so many PS stores losing customers because they see an Out of Stock message on a product that actually HAS stock on other combinations. It's already beyond ridiculous, this silence of the PS staff. This a call of desperation to the PS staff, of a lot of PS users, not just mine. Let the solution reveal itself at last!#MegaBump 3 Link to comment Share on other sites More sharing options...
Marius05 Posted January 26, 2017 Share Posted January 26, 2017 PM for this MODULE Link to comment Share on other sites More sharing options...
razvypp Posted September 5, 2019 Share Posted September 5, 2019 You can use a cron job to reset it, this is how i do it $sql = 'SELECT * FROM `'._DB_PREFIX_.'product_attribute` GROUP by id_product'; $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executes($sql); if($results) { foreach($results as $res) { $sql = 'SELECT * FROM `'._DB_PREFIX_.'product_attribute` WHERE quantity > 0 AND id_product = '.(int)$res['id_product']; $new_res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); if($new_res) { Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('UPDATE `'._DB_PREFIX_.'product_attribute_shop` SET default_on = 1 WHERE id_product_attribute = '.(int)$new_res['id_product_attribute']); Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET default_on = 1 WHERE id_product_attribute = '.(int)$new_res['id_product_attribute']); Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('UPDATE `'._DB_PREFIX_.'product_attribute_shop` SET default_on = NULL WHERE id_product_attribute = '.(int)$res['id_product_attribute']); Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('UPDATE `'._DB_PREFIX_.'product_attribute` SET default_on = NULL WHERE id_product_attribute = '.(int)$res['id_product_attribute']); } } } 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