Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / shopping cart - hide the Cart Quantity Update button when not needed

shopping cart - hide the Cart Quantity Update button when not needed

Locked

Views: 8,889

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
27 Oct 2008, 9:14 AM
#1
dause avatar

dause

New Zenner

Join Date:
Sep 2008
Posts:
33
Plugin Contributions:
0

shopping cart - hide the Cart Quantity Update button when not needed

I found it inconvenient that the cart quantity update button is always visible even for articles where the quantity can not be changed.
In such cases the button does not have any function and should better be hidden.

Here is a fix that I created:

in tpl_shopping_cart_default.php look for these lines:

<?php
  if ($product['buttonUpdate'] == '') {
    echo '' ;
  } else {
    echo $product['buttonUpdate'];
  }
?>

and change them to:

<?php
  if ($product['buttonUpdate'] == '' || $product['flagShowFixedQuantity'] ) {
    echo '' ;
  } else {
    echo $product['buttonUpdate'];
  }
?>

BTW: $product['flagShowFixedQuantity'] and $product['showFixedQuantity'] seem identical to me. Is there any reason why there are two fields in the array holding the same information? Thanks!

27 Oct 2008, 9:38 AM
#2
dause avatar

dause

New Zenner

Join Date:
Sep 2008
Posts:
33
Plugin Contributions:
0

Re: shopping cart - hide the Cart Quantity Update button when not needed

One thing that is bothering me:
I just found that this modification does not only remove the Cart Quantity Update button but also a hidden input field that I don't quite understand:

<input name="products_id[]" value="11:f3c45f2df15c4d1605fbe80af8038a78" type="hidden">

Q: Should this input field better be preserved or can I remove it without any danger when removing the cart quantity update button? (and what does it do?)
Thanks!

27 Oct 2008, 10:45 AM
#3
dause avatar

dause

New Zenner

Join Date:
Sep 2008
Posts:
33
Plugin Contributions:
0

Re: shopping cart - hide the Cart Quantity Update button when not needed

one more question:

Evaluating the condition

 if ($product['buttonUpdate'] == '')

does not seem to make much sense in the first place. To me it looks like $product['buttonUpdate'] is never an empty string as I found when looking at the code in
includes/modules/pages/shopping_cart/header_php.php:

somewhere around line 140:

$buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);

($buttonUpdate gets later assigned to $productArray['buttonUpdate'])
Is that an error or have I missed something? Thanks!

1 May 2009, 10:22 AM
#4
dlg_ie avatar

dlg_ie

New Zenner

Join Date:
Oct 2008
Posts:
30
Plugin Contributions:
0

Re: shopping cart - hide the Cart Quantity Update button when not needed

Hi,

I agree with the above problem description and I have the same issue.

I think having two "update cart" buttons is not necessary (the "top" one next to the product image and text, and the "bottom" one next to "continue shopping").

I want to remove the top one. I found that if I comment out line 80 in my tpl_shopping_cart_default.php :

echo $product['buttonUpdate'];

the top button does disappear but the function "update cart" stops working (when clicking the bottom button).

Any help ?

Denis

1 May 2009, 10:28 AM
#5
dlg_ie avatar

dlg_ie

New Zenner

Join Date:
Oct 2008
Posts:
30
Plugin Contributions:
0

Re: shopping cart - hide the Cart Quantity Update button when not needed

Ooops... posted to quickly, found the solution :

http://www.zen-cart.com/wiki/index.php/Admin_-_Configuration_-_Stock (bottom of the page) :

================

  • Show Shopping Cart - Update Cart Button Location
    (Admin - Catalog)

    Controls the location of the Update Cart button in the Shopping Cart.
    Options are:

         * 1 = Next to each Qty Box
         * 2 = Below all Products
         * 3 = Both Next to each Qty Box and Below all Products 
    

    Default: 3 *

================

Dause, even that does not explain how to completely remove the button for fixed quantity products, it still looks better having one button below rather than a button next to the product.

Denis

1 Oct 2009, 3:28 AM
#6
scatzc avatar

scatzc

New Zenner

Join Date:
Sep 2009
Posts:
79
Plugin Contributions:
0

Re: shopping cart - hide the Cart Quantity Update button when not needed

dlg_ie:

even that does not explain how to completely remove the button for fixed quantity products, it still looks better having one button below rather than a button next to the product.
I agree. In my case the shopping cart can have only one item of each product (per order).

I managed to remove the the Cart Quantity Update button next to each product ( Admin > Configuration > Stock > Show Shopping Cart - Update Cart Button Location = 2).

Is the only way to remove the shared (bottom) Cart Quantity Update button via hacking tpl_shopping_cart_default.php as dause described?

Thanks.