Author Topic: [Solved] Low stock alert working but not as expected  (Read 2478 times)

aftertaf

  • Guest
[Solved] Low stock alert working but not as expected
« 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

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10530
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Low stock alert working but not as expected
« Reply #1 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
Code: [Select]
if ($checkForDisable) {
$productsleft = $product->product_in_stock - $product->product_ordered;

if ($quantity >= $productsleft ){

remove the = in the if($quantity expression

Code: [Select]
if ($checkForDisable) {
$productsleft = $product->product_in_stock - $product->product_ordered;

if ($quantity > $productsleft ){
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

aftertaf

  • Guest
Re: Low stock alert working but not as expected
« Reply #2 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 ;)