I have a condition that I have to change/decrease the stock only when the order status changes to processing. By default it is changed as soon as order is placed. But, this is what I need to achieve.
-
have you tried so far?– Amit Bera ♦Jul 27, 2016 at 10:48
-
I am trying to find the controller/model that decreases the value, but I am unable to find it. By the way, plan is to override that particular file and then create custom event to fire an observer for that order status change and then in that observer , decrease the quantity.– Abhishek Dhanraj ShahdeoJul 27, 2016 at 10:51
1 Answer
First,read the question When does Magento decrement quantity
Let do some tricky code this requirement.
First,in order to stop decrement rewrite the Observer classMage_CatalogInventory_Model_Observer
.
At this class add this code for revert the stock which just decrease.
$items = $this->_getProductsQty($quote->getAllItems());
Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items);
Then using sales_order_save_after
with checking order status process you can deducted the stock