PDA

View Full Version : Re-stock quantities from canceled orders



michael_s
02-25-2013, 12:14 PM
This contribution allows to re-stock product quantities, when orders are canceled or returned.

Usage is simple, when the order status change to Canceled or Returned from another status that it was not Canceled nor Returned, the product quantities of that order are put back on the product stock. When the order status was Canceled or Returned and it is changed to another status that is not Canceled nor Returned, the quantities in the order are removed from the product stock.
When you change order status between Canceled and Returned, no change in the stock is made.
When you change you order status between status that is not Canceled nor returned, no change in the stock is made.

Example, assuming you have 1=Canceled; 2=Returned; 3= New Order; 4=Waiting for Payment:
- Changing from New Order to Canceled or Returned -> Order quantities are put back in stock
- Changing from Canceled to New Order or Waiting Payment -> Order quantities are removed from the products stock
Changing from Canceled to Returned (or vice-versa) -> no change in the stock
Changing from New Order to Waiting Payment (or vice-versa) -> no change in the stock

As the canceled and returned status order ID are hard-coded, you may need to adapt the code to suite your needs.

This has been done in v2.2, but it should also work in v2.3.x.

More... (http://addons.oscommerce.com/info/8707)