Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / [done v1.3.9] add selected items to cart - says success even if 0 items selected

[done v1.3.9] add selected items to cart - says success even if 0 items selected

Locked
This thread is locked. New replies are disabled.
13 Dec 2007, 5:54 PM
#1
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Post #1 by gsdcypher

hi all,

when there is a page with mulitiple items listed, and the user clicks the add selected items to cart but the user does not select any items the cart still shows the successfully added items to cart box....

how do i make it show a warning box instead that says you did not select any items?

thanks

13 Dec 2007, 6:12 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

What is your setting for Admin->Configuration->My Store->Display Cart After Adding Product ?
What version of Zen Cart?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Dec 2007, 6:51 PM
#3
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Post #3 by gsdcypher

display cart after adding items - false
zen cart version - 1.3.7

13 Dec 2007, 8:30 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

/includes/classes/shopping_cart.php
at line 1706 you have the following section of code.
Make the three alterations shown:```
function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
[B] $addCount = 0;[/B]
while ( list( $key, $val ) = each($_POST['products_id']) ) {
if ($val > 0) {
$adjust_max = false;
$prodId = $key;
$qty = $val;
$add_max = zen_get_products_quantity_order_max($prodId);
$cart_qty = $this->in_cart_mixed($prodId);
$new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');

    if (($add_max == 1 and $cart_qty == 1)) {
      // do not add
      $adjust_max= 'true';
    } else {
      // adjust quantity if needed
      if (($new_qty + $cart_qty > $add_max) and $add_max != 0) {
        $adjust_max= 'true';
        $new_qty = $add_max - $cart_qty;
      }
      $this->add_cart($prodId, $this->get_quantity($prodId)+($new_qty));

[B] $addCount++;[/B]
}
if ($adjust_max == 'true') {
$messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' C: - ' . zen_get_products_name($prodId), 'caution');
}
}
}
// display message if all is good and not on shopping_cart page
if ([B]$addCount && [/B]DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
$messageStack->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
}
zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
}


I've moved this to the bug reports area, as resolution.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Dec 2007, 12:04 AM
#5
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Post #5 by gsdcypher

Thanks. That fixed it. :-)