JNestudi Posted January 30, 2016 Share Posted January 30, 2016 Hi! I have created a status for the orders called "Cancelled" that makes the orders not longer valid and delete the invoice... I have detected that when I put an order as cancelled prestashop send back the products on the order multiplied by 7!!!!!! I have no idea why is happening that and no idea where to start looking... I already looked for an overdrive and I looked ad the class Stockavailable but nothings seems to be multiplying by 7 anithing... I mean should appear a number 7 don't you think? Could be a internal loop? P.D. I'm running 1.6.0.6 version Help me please!!! Link to comment Share on other sites More sharing options...
Nelluz Posted June 7, 2017 Share Posted June 7, 2017 Hello, i have the same issue. if the order status change in canceled, the stock resultes wrong. it adds stock. the stock doesn't come back to initial status Link to comment Share on other sites More sharing options...
musicmaster Posted June 7, 2017 Share Posted June 7, 2017 I suggest that you set .'_PS_DEBUG_PROFILING_' in config/defines.inc.php to true. You get then below each page a list of all database queries that are done. Studying them should bring you closer to an explanation. There might be a complication if these are Ajax commands. Link to comment Share on other sites More sharing options...
ricardomyra Posted October 2, 2023 Share Posted October 2, 2023 (edited) I had the same problem and the error was in a change I had made to the order.php class file. I changed this original piece of code: public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id) LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop) WHERE od.`id_order` = '.(int)$this->id); } I changed it to: public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN '._DB_PREFIX_.'product p ON ( p.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) WHERE od.`id_order` = '.(int)($this->id)); } And the correction I made was to include this in the code: public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN '._DB_PREFIX_.'product p ON ( p.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product and pl.id_lang=2) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) WHERE od.`id_order` = '.(int)($this->id)); } This query that contained the error was returning more than one record and this caused the problem, I hope this tip can help other people. In my case 2 records were returned and the quantities returned to stock were multiplied by 2 when an order was cancelled. I use version 1.6.1.4 PS: I made this change to be able to get the product image link and show the product photo on the screen where the customer has the order details. Edited October 2, 2023 by ricardomyra (see edit history) 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