VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: kevinwood on August 16, 2014, 15:43:44 PM

Title: VM 2.9.8a Able to add items to cart even when exceeding max order level
Post by: kevinwood on August 16, 2014, 15:43:44 PM
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. 
Title: Re: VM 2.9.8a Able to add items to cart even when exceeding max order level
Post by: jenkinhill on August 16, 2014, 15:51:10 PM
Try with 2.9.9 - from http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: VM 2.9.8a Able to add items to cart even when exceeding max order level
Post by: kevinwood on August 16, 2014, 16:18:24 PM
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'];