News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

VM 2.9.8a Able to add items to cart even when exceeding max order level

Started by kevinwood, August 16, 2014, 15:43:44 PM

Previous topic - Next topic

kevinwood

There appears to be a bug in VM 2.9.8a that allows you to add items to the cart that exceed the product's max order level.

If I have an item in my cart and then continue shopping and click "add to cart" on the same product, I see in my system messages "The maximum order level for this product is 1 items." four times, followed by "Product successfully added".  My cart then shows that the quantity has indeed increased.

It looks to me like the problem is in /components/com_virtuemart/helpers/cart.php.  Line 568 appears to be updating the quantity in the cart before bothering to do checkForQuantities. 

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

kevinwood

Quote from: jenkinhill on August 16, 2014, 15:51:10 PM
Try with 2.9.9 - from http://dev.virtuemart.net/projects/virtuemart/files

Updated to 2.9.9.  It still adds the item to the cart.  The only difference is that I only see "The maximum order level for this product is 1 items." twice instead of four times.

Update: In 2.9.9, the suspect line is 570:

$cartProductData['quantity'] = $cartProductData['quantity'] + $productData['quantity'];