Zen Cart Logo
Forums / Bug Reports / adjust quantity for max qty order in shopping cart

adjust quantity for max qty order in shopping cart

Locked

Views: 2,882

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

adjust quantity for max qty order in shopping cart

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

Re: adjust quantity for max qty order in shopping cart

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

Re: adjust quantity for max qty order in shopping cart

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

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

ajeh

Oba-san

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

Re: adjust quantity for max qty order in shopping cart

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 ...