News:

Looking for documentation? Take a look on our wiki

Main Menu

Sold out products being available to buy [VM 4.0.2]

Started by Rune Rasmussen, August 11, 2022, 11:06:57 AM

Previous topic - Next topic

Rune Rasmussen

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
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

GJC Web Design

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;
}


GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Rune Rasmussen

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...
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Studio 42

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

Rune Rasmussen

#4
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...
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team