winresh24 Posted April 27, 2016 Share Posted April 27, 2016 (edited) How to avoid decreasing of a product quantity when it's still in the "Process" and update when the order was shipped or delivered? Anyone Could help me with this? Right now I add this $id_order_state != Configuration::get('PS_OS_PREPARATION') in the statement of checkProductStock in OrderDetail.php and yes it doesn't decrease the quantity but when the order was shipped and delivered it doesn't change too. protected function checkProductStock($product, $id_order_state) { if ($id_order_state != Configuration::get('PS_OS_CANCELED') && $id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_PREPARATION')) { $update_quantity = true; if (!StockAvailable::dependsOnStock($product['id_product'])) { $update_quantity = StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], -(int)$product['cart_quantity']); } if ($update_quantity) { $product['stock_quantity'] -= $product['cart_quantity']; } if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT')) { $this->outOfStock = true; } Product::updateDefaultAttribute($product['id_product']); } } Thanks Edited April 27, 2016 by winresh24 (see edit history) Link to comment Share on other sites More sharing options...
winresh24 Posted April 28, 2016 Author Share Posted April 28, 2016 anyone can give me a hint? please Link to comment Share on other sites More sharing options...
liyinan Posted August 19, 2016 Share Posted August 19, 2016 Have you solved the problem? Link to comment Share on other sites More sharing options...
vekia Posted August 19, 2016 Share Posted August 19, 2016 this requires modification of prestashop core, especially order status (orderhistory) change function where it will be necessary to add code to decrease item stock when you will select some order states. Link to comment Share on other sites More sharing options...
dandumit Posted March 24, 2018 Share Posted March 24, 2018 How could I found out when the stock it's decreased ? On which of order states ? Link to comment Share on other sites More sharing options...
HouseofJewellery Posted October 19, 2018 Share Posted October 19, 2018 On 8/19/2016 at 11:08 AM, vekia said: this requires modification of prestashop core, especially order status (orderhistory) change function where it will be necessary to add code to decrease item stock when you will select some order states. Can you expand a bit on that please? 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