VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: aftertaf on May 29, 2018, 16:45:21 PM

Title: [Solved] Low stock alert working but not as expected
Post by: aftertaf on May 29, 2018, 16:45:21 PM
Hi,
Joomla 3.8.7 / VM 3.2.14

Current Configuration of Virtuemart:
Stock handling on product level (i.e. Per Product)is enabled, and option 'Displays 'Notify Me' instead of 'Add To Cart' button' is set.
Send low stock notification is enabled.

Current configuration of the product in question:
Stock handling is set to Use Global Configuration
Product in Stock = 1
Booked, Ordered = 0
Low Stock Alert = 1

Vendor received a low stock notification once the order was placed (so when stock is 0, not 1)

Is this normal/configurable ?

As i'm testing this I see another small error/bug/mistake...
Situation:
test product has 2 in stock.
I add 2 of the product to the basket.
OK so far
Then I click the link to go to basket and i get a vmError : Maximum quantiy has been reached, the new quantity for your order has been decreased to 2
Problem being that i ordered 2, so I didnt try to order more than what I have in stock, so the error
shouldn't be raised.
And same error message raised again when i proceed to checkout and pay, though the order of 2 products does complete successfully.
thanks

edit:
fixed since http://dev.virtuemart.net/projects/virtuemart/repository/revisions/9855
Title: Re: Low stock alert working but not as expected
Post by: Milbo on May 31, 2018, 16:12:06 PM
FE /helpers/cart.php

around line 1670 search for private function checkForQuantities($product, &$quantity=0) {

search for

if ($checkForDisable) {
$productsleft = $product->product_in_stock - $product->product_ordered;

if ($quantity >= $productsleft ){


remove the = in the if($quantity expression


if ($checkForDisable) {
$productsleft = $product->product_in_stock - $product->product_ordered;

if ($quantity > $productsleft ){
Title: Re: Low stock alert working but not as expected
Post by: aftertaf on June 04, 2018, 23:13:56 PM
thanks!
i see this is fixed in the code : http://dev.virtuemart.net/projects/virtuemart/repository/revisions/9855
:)

around line 1760 for me, but hey, who's counting ;)