If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / adjust quantity for max qty order in shopping cart

adjust quantity for max qty order in shopping cart

Locked

Started by peeceelee on 22 Aug 2006, 6:41 PM · Views: 2,901

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
22 Aug 2006, 6:41 PM
#1
peeceelee avatar

peeceelee

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

Post #1 by peeceelee

I have a product X with "Product Qty Maximum:" set to 3
On a page with multiple products added to the shopping cart, If I try to add 5 to the shopping cart along with some other products, I get the error
"Qty Adjusted - Maximum Qty Added to Cart - Product name x"
but I get it not only for product X, but also any products in the cart below product X

Only the qty for product X gets adjusted...the others are fine even though the error shows up.

I did some digging and found that the $adjust_max was not set to false in the beginning of the function, and so every product after the product X was also flagged for the error to show up.

includes/classes/shopping_cart.php

Original code:

function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
while ( list( $key, $val ) = each($_POST['products_id']) ) {
if ($val > 0) {

add this to line after while starts:
$adjust_max= 'false';

my edited code:

function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
while ( list( $key, $val ) = each($_POST['products_id']) ) {
$adjust_max= 'false';
if ($val > 0) {

22 Aug 2006, 6:42 PM
#2
peeceelee avatar

peeceelee

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

Post #2 by peeceelee

sorry, forgot to say I'm using v1.3.0.2 with the new security fixes installed also.

22 Aug 2006, 8:30 PM
#3
ajeh avatar

ajeh

Oba-san

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

Post #3 by ajeh

Have you an URL for this that we can peek at? I cannot reproduce this error ...

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!

22 Aug 2006, 9:03 PM
#4
ajeh avatar

ajeh

Oba-san

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

Post #4 by ajeh

While I call that a feature ... some might call that a ... umm ... bug ... :eek:

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

Around lines 1678 - 1681 you should see:

  function actionMultipleAddProduct($goto, $parameters) {
    global $messageStack;
    while ( list( $key, $val ) = each($_POST['products_id']) ) {
      if ($val > 0) {

Change that to read:

function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
while ( list( $key, $val ) = each($_POST['products_id']) ) {
if ($val > 0) {
$adjust_max = false;

You are just adding the: $adjust_max = false; below that code ...

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!