Author Topic: VM 2.9.8a Able to add items to cart even when exceeding max order level  (Read 978 times)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28314
  • Always on vacation
    • Jenkin Hill Internet
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart  4.0.2 10661 on Joomla 3.10.9 PHP 7.4.29

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: VM 2.9.8a Able to add items to cart even when exceeding max order level
« Reply #2 on: August 16, 2014, 16:18:24 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:

Code: [Select]
$cartProductData['quantity'] = $cartProductData['quantity'] + $productData['quantity'];