If this is your first visit, check our documentation. To post, register or login.
Forums / Bug Reports / The quantity added to your cart has been adjusted because of a restriction on max

The quantity added to your cart has been adjusted because of a restriction on max

Locked

Started by tlwolter on 17 Aug 2010, 2:14 PM · Views: 6,935

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
17 Aug 2010, 2:14 PM
#1
tlwolter avatar

tlwolter

New Zenner

Join Date:
Aug 2010
Posts:
6
Plugin Contributions:
0

The quantity added to your cart has been adjusted because of a restriction on max

I am having a problem in my shopping cart. I have products that have quantity limits set. I can add a product to the cart with out issue. I start to have problems when I try to change the quantities in the shopping cart. I have a max quantity set to 10 items. If I only have a quantity of 1 in the cart and want to change it to 2, I have no problem. However, if I have 1 and want to change to 10, I get the message that I have exceeded my limit. It acts like it is adding the previous value and the changed value to determine if I am exceeding my quantity limit. You can view my site at: https://www.crappietomtackle.com/shop

17 Aug 2010, 4:19 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

If you edit the file:
/includes/classes/shopping_cart.php

and change the code around line 1557 to read:

          // adjust quantity if needed
[B]          if ($new_qty > $add_max) {[/B]
            if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {
              $adjust_max= 'true';
              $new_qty = $add_max - $cart_qty;
            }
[B]          }
[/B]

does this fix the problem?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Aug 2010, 5:14 PM
#3
tlwolter avatar

tlwolter

New Zenner

Join Date:
Aug 2010
Posts:
6
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

That did indeed fix the problem. Thanks for the quick assistance.

17 Aug 2010, 5:52 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

Thank you for confirming that this was able to fix the Maximum Value issue that you were having with the update quantity ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Aug 2010, 12:47 PM
#5
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,456
Plugin Contributions:
4

Re: The quantity added to your cart has been adjusted because of a restriction on max

What version is this one?

IDEASLady
IDEAS Creative Studio

Your image... our business!

18 Aug 2010, 1:49 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

I believe this is a problem in v1.3.9e and v1.3.9f ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Aug 2010, 3:00 PM
#7
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

seeing this error in 1.3.9e:

shopping cart page:

The quantity added to your cart has been adjusted because of a restriction on maximum you are allowed. See this item:

Error triggered by deleting items with checkbox(es) and update cart button on cart page

error on all remaining products that are in cart, that are:

Product Qty Minimum: 1
Product Qty Maximum: 1
Product Qty Units: 1
Product Qty Min/Unit Mix: Yes
Products Quantity: 1

*not seeing this error on products that are in cart, that are: :

Product Qty Maximum: *more than 1
Products Quantity: *more than 1


ALSO: Using the trash can icon to delete (not the checkbox/update cart) does not trigger this error.

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

20 Aug 2010, 3:53 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

This is fixed in v1.3.9f ...

//die('I see Update Cart: ' . $_POST['products_id'][$i] . ' add qty: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
        if (($add_max == 1 and $cart_qty == 1)) {
          // do not add
          $adjust_max= 'true';
        } else {
          // adjust quantity if needed
          if ($new_qty > $add_max) {
            if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {
              $adjust_max= 'true';
              $new_qty = $add_max - $cart_qty;
            }
          }
          $attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
          $this->add_cart($_POST['products_id'][$i], $new_qty, $attributes, false);
        }
        if ($adjust_max == 'true') {

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Aug 2010, 4:05 PM
#9
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

Hi Linda!

I tried that fix before posting in includes/classes/shopping_cart.php but it had no effect.

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

20 Aug 2010, 4:42 PM
#10
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

I just tried using the includes/classes/shopping_cart.php from 1.3.8f still no effect (the only change from 1.3.9e to f is the breadcrumb fix)

I then dialed back to 1.3.9d's includes/classes/shopping_cart.php and do not see the errors.

Must have something to do with these doohickies (added lines from d to e/f):

Line 1535-1537:

      if ($_POST['cart_quantity'][$i] == '') {
        $_POST['cart_quantity'][$i] = 0;
      }

and Line 1546:

        $cart_qty = $this->in_cart_mixed($_POST['products_id'][$i]);

Should I just take those bad boys out?:unsure:

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

20 Aug 2010, 5:05 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

If you have not made any changes previously to the:
/includes/classes/shopping_cart.php

what happens if you load the file from the v1.3.9f to the server? :unsure:

Make sure that you are updating the file on the server and see the changes ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Aug 2010, 5:17 PM
#12
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

Hi sorry if I wasn't clear, all testing above is on a live server.

I tested the 1.3.9f file (which does not contain the > if ($new_qty > $add_max) { { fix.

I tested the 1.3.9e file (adding in the > if ($new_qty > $add_max) { { fix.

nothing works but the 1.3.9d file. The trouble makers are the two added lines up there in e/f :rolleyes: Line 1535-1537:and Line 1546:

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

20 Aug 2010, 5:22 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

umm ... I need to look into this further ... I thought I committed the fix to v1.3.9f ... :unsure:

Let me check a few things ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Aug 2010, 5:35 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

Oops ... guess it is not in v1.3.9f ... sorry about that ...

Have you an URL to your site where I can see this one with errors with the checkboxes to make sure everything is covered?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Aug 2010, 5:58 PM
#15
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

PM sent

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

20 Aug 2010, 6:02 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

Thanks for that ...

I did finally reproduce the problem with the checkboxes ... back to the drawing board ... :blink:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Sep 2010, 12:53 AM
#17
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

About to upgrade to 1.3.9g.

The coding that created this bug is still in.

Is there a workaround? or is it safe to remove the 2 lines of code that were added in 1.3.9e/f now g?:unsure: in order to fix this issue (warnings when customer edits shopping cart)

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

3 Nov 2010, 8:28 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: The quantity added to your cart has been adjusted because of a restriction on max

The real fix to this ... and do test this ... :cool:

In the file:
/includes/classes/shopping_cart.php

Add to the code around line 1557:

         $add_max = zen_get_products_quantity_order_max($_POST['products_id'][$i]);
         $cart_qty = $this->in_cart_mixed($_POST['products_id'][$i]);
         $new_qty = $_POST['cart_quantity'][$i];
         $current_qty = $this->get_quantity($_POST['products_id'][$i]);

Change this line:

        if (($add_max == 1 and $cart_qty == 1)) {

to read:

        if (($add_max == 1 and $cart_qty == 1) && $new_qty != $cart_qty) {

Change this line:

          if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {

to read:

          if ($add_max != 0 && $new_qty > $current_qty && ($cart_quantity - $current_qty + $new_qty) != 0 && (($cart_quantity - $current_qty + $new_qty) + $cart_qty > $add_max)) {

and let us know how this works for you ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Nov 2010, 9:01 PM
#19
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

Upgrading to 139h hopefully next week:flex:, I'll test it out on h:bigups:thanks!

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

16 Nov 2010, 6:34 PM
#20
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: The quantity added to your cart has been adjusted because of a restriction on max

So far this fix seems to work flawlessly on 1.39h! :flex:Thanks for reading all my posts :book: and fixing this issue! :clap:

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41