VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Kuubs on January 28, 2020, 11:29:50 AM

Title: Stockhandling, products ordered and products in stock issue
Post by: Kuubs on January 28, 2020, 11:29:50 AM
Hello,

I found a weird issue, and I don't think this is really how it is supposed to work. I have a product with 15 products in stock, and the product has been ordered 21 times in the past. Now the product shows that it is not in stock anymore. I checked the code and that is due to this line:

if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock - $product->product_ordered) < $minOrderLevel) { ?>

It subtracts the product ordered amount of the amount in stock, that is weird because why should it do that? How many times the product is ordered has nothing to do with it. I removed the subtraction and checked the amount in stock against the minOrderLevel and now it works again. Maybe this is somethign that needs to be checked out.
Title: Re: Stockhandling, products ordered and products in stock issue
Post by: Jörgen on January 28, 2020, 12:48:48 PM
Hello

Of course you have to consider how many items that are ordered (actually booked), You have to set Your order statuses correctly so that the ordered products are drawn from the stock when the order is shipped. product_ordered is not a counter for the total ordered items it is a counter for orders that have been confirmed but actually haven´t been delivered.

Jörgen @ Kreativ Fotografi
Title: Re: Stockhandling, products ordered and products in stock issue
Post by: Kuubs on January 28, 2020, 17:24:08 PM
Quote from: Jörgen on January 28, 2020, 12:48:48 PM
Hello

Of course you have to consider how many items that are ordered (actually booked), You have to set Your order statuses correctly so that the ordered products are drawn from the stock when the order is shipped. product_ordered is not a counter for the total ordered items it is a counter for orders that have been confirmed but actually haven´t been delivered.

Jörgen @ Kreativ Fotografi

Aha, that explains a lot. Thank you. I see indeed that these orders are not acutally having the "Sent" status. So I understand why this happens.