Inventory Tracking
Inventory Tracking
It looks to me like a product's stock level is not reduced until after the payment is completed. (e.g., Credit Card captured.) Anybody have a good idea on how to decrement the stock level as soon as the order itself is created? Right now, I'm thinking that I'll have to do that, and then increment the stock level upon payment completion, somehow.
Re: Inventory Tracking
I recently noticed the Order Statuses page in the Admin panel. (Configure > Order Statuses), and that I can set the "Payment Pending" status to Destock, so that's good. But during the CheckedOut event, the product's InStock value still wasn't changed. ((OrderDataSource.Load(e.OrderId)).Items[n].Product.InStock) So if anyone else runs into this situation, beware.
To get the newly updated stock level, I had to load a ProductCollection of all the products (ProductDataSource.LoadForCriteria()). Only then was I able to update each Product as necessary (and then save the ProductCollection). I'm not sure why the Items[n].Product.InStock wasn't updated, but when loaded from ProductDataSource, the InStock quantity DID have the new value.
My only hope is that it wasn't a symptom of an asynchronous process that simply happened to finish between the two data source loads. If that's the case, then I may not be able to guarantee that this will always work as it ought to.
To get the newly updated stock level, I had to load a ProductCollection of all the products (ProductDataSource.LoadForCriteria()). Only then was I able to update each Product as necessary (and then save the ProductCollection). I'm not sure why the Items[n].Product.InStock wasn't updated, but when loaded from ProductDataSource, the InStock quantity DID have the new value.
My only hope is that it wasn't a symptom of an asynchronous process that simply happened to finish between the two data source loads. If that's the case, then I may not be able to guarantee that this will always work as it ought to.