If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / Auto Update Max Quantity Bug

Auto Update Max Quantity Bug

Started by numinix on 3 Jun 2011, 4:47 AM · Views: 946

Results 1 to 1 of 1
3 Jun 2011, 4:47 AM
#1
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,572
Plugin Contributions:
60

Post #1 by numinix

Say a product has a max of 3. If you add 50 to the cart, it will auto adjust to 3, this is correct. However, if you then try to change it to 2, it'll become 3 again and show the error.

This is happening because of this line of code in includes/classes/shopping_cart.php around line 1560:

          if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {
            $adjust_max= 'true';
            $new_qty = $add_max - $cart_qty;
          }

Should it not just be:

          if (($new_qty > $add_max) and $add_max != 0) {
            $adjust_max= 'true';
            $new_qty = $add_max;
          }