Configuration:
Action when a Product is Out of Stock ->
Stockhandling on product level: No
Displays 'Notify Me' instead of 'Add To Cart' button
Even with the mentioned configuration we see from time to time that products end up being available to buy when they actually is out of stock.
This happens when they for some unknown reason sometimes ends up having a negative value on 'Booked, ordered' in 'Product Status'.
I guess it's two issues in this:
- The system ends up having negative values for 'Booked, ordered', in some rare cases.
- The system can't handle the negative values when deciding if the 'Buy' or 'Sold out' button should be displayed.
*Confirmed also with vmbeez3
negative stock is created because the stock level is calc'd by $product->product_in_stock - $product->product_ordered
in the model the decision to show the Notify button is decides by
($product->product_in_stock - $product->product_ordered) < $minOrderLevel -> show notify
$minOrderLevel is either set as a product_params or defaults to 1
if ($child->min_order_level > 0) {
$minOrderLevel = $child->min_order_level;
} else {
$minOrderLevel = 1;
}
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($child->product_in_stock - $child->product_ordered) < $minOrderLevel) {
$child->orderable = false;
$child->show_notify = true;
}
Thanks, but it's the 'Booked, ordered' ending up being negative - and it puzzles me how that can happen.
Anyhow, if you have a stock of lets say 1 or 0, then -2 on 'Booked, ordered', we end up having a plus value in stock calculation...
Negative values are most time when you do not check for booked products when you add some stock for products
It's why VM Be pro support +1, +2 .... as import values and not only 1 or 2 to prevent this problem that most shop have
Hm ... adding or changing stock shouldn't make booked negative, unless also booked are manually edited. Booked should reflect what's actually in orders, and should probably better not be possible to edit easily...