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

aftertaf

  • Jr. Member
  • **
  • Posts: 206
    • sO couture
  • VirtueMart Version: 3.2.14
[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
Webmaster for my wife (link in my profile ;)
Extensions / plugins : POSForWebshops, TemplatecreatorCK ,MaximenuCK, and PageBuilderCK, VM BatchEdit Pro, VM CustomFilters Pro, Awocoupon Pro, slogin, supersaas,  among other things...
Joomla! 3.8.6//VM 3.2.14//PHP7.0.18 & mariadb 10.1.22 on Debian
big up to notepad++!!!!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9667
  • VM3.2 Cached and Optimized
    • 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 ){
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

aftertaf

  • Jr. Member
  • **
  • Posts: 206
    • sO couture
  • VirtueMart Version: 3.2.14
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 ;)
Webmaster for my wife (link in my profile ;)
Extensions / plugins : POSForWebshops, TemplatecreatorCK ,MaximenuCK, and PageBuilderCK, VM BatchEdit Pro, VM CustomFilters Pro, Awocoupon Pro, slogin, supersaas,  among other things...
Joomla! 3.8.6//VM 3.2.14//PHP7.0.18 & mariadb 10.1.22 on Debian
big up to notepad++!!!!