Zen Cart Logo
Forums / Customization from the Admin / How to remove Add to Cart quantity from product info page?

How to remove Add to Cart quantity from product info page?

Views: 11,594

Results 1 to 16 of 16
26 Sep 2007, 11:33 PM
#1
emilfalcon avatar

emilfalcon

New Zenner

Join Date:
Sep 2007
Posts:
26
Plugin Contributions:
0

How to remove Add to Cart quantity from product info page?

Currently the "Add to Cart" button on my product info page is preceded by a quantity text input that defaults to 1. Since 99.9% of my clients will only be purchasing one item of a certain type, I would like to remove this input field and have it always default to 1. Unfortunately, I am unable to find the option to make this change in the zencart admin. Can anyone help me?

Thanks in advance!

29 Sep 2007, 1:02 AM
#2
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

Open the product's page in Catalog --> Categories/Products. (Find the product you want to edit.)

Scroll down and find:
Products Quantity Box Shows: Yes, Show Quantity Box No, Do not show Quantity Box

Set to NO for do not show.

Below that you can set the min/max/units if need be.

And in Configuration --> Product listing there are other settings too.

HTH,

12 Nov 2009, 9:46 PM
#3
aleena avatar

aleena

New Zenner

Join Date:
Nov 2009
Posts:
3
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

this thread was really useful for me . thanks alot guys ^^

10 Dec 2010, 3:50 AM
#4
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

bringing this thread back from the dead!
is there a way to do this to every product at once? we have close to 1000 products and really don't want to have to go into each and every product page to turn off the "Add to: [form box]".
i'm even willing to pull it from the appropriate tpl_ page (tpl_product_info_display.php, i think) in my template to save the trouble. problem is, i'm not sure what part of the php it is.

actually, i'll just paste in the bit of php here in hopes that one of you who know better than me can show me what to take out.
i'm wanting to remove the "Add to: [form box]", but keep the "Add to Cart" button.

<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>
            <?php
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
            if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
              // hide the quantity box and default to 1
              $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            } else {
              // show the quantity box
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->
10 Dec 2010, 4:43 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: How to remove Add to Cart quantity from product info page?

If you just want to change the setting on ALL Products in the database to NOT show the quantity box on ALL Product ...

1 Backup your database

2 See first step

3 Run the following SQL statement in the Tools ... Install SQL Patches:

UPDATE products SET products_qty_box_status = 0;
10 Dec 2010, 4:49 AM
#6
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

awesome, that did it! thank you!

if i were to ever want to undo this patch and bring that box back, what would i have to do?
i don't plan on ever needing to, but it would be good to know, just in case.

10 Dec 2010, 4:52 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: How to remove Add to Cart quantity from product info page?

Set them to 1 instead of 0 ... :smile:

10 Dec 2010, 9:07 PM
#8
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

it is worth noting to any other new people who come along that the patch provided by Ajeh works great, but you will have to re-apply it after adding new products. it only updates what you've already got on your site and the "Add to cart" box will show up on anything you add after the patch.

thanks again Ajeh!

10 Dec 2010, 9:28 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: How to remove Add to Cart quantity from product info page?

When you add a new Product, can't you just set the box status while adding the product? :unsure:

10 Dec 2010, 9:38 PM
#10
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

yeaah, but we have a data entry guy just flying through and adding products super quick. apparently it's too much hassle to have him click the extra button as he goes.
not a big deal, i backup the data files at the end of the day anyway, i'll just apply the patch every night after until we get everything up.

10 Dec 2010, 10:11 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: How to remove Add to Cart quantity from product info page?

You could go to the Configuration ... Product Info ... and change the setting:

Product Quantity Box Status - Adding New Products
What should the Default Quantity Box Status be set to when adding New Products?

0= off
1= on
NOTE: This will show a Qty Box when ON and default the Add to Cart to 1

11 Dec 2010, 12:48 AM
#12
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

hahahah thanks so much for pointing that out to me. i thought i looked everywhere for such a setting, and must have totally looked over it. that's what i was asking about when i brought this thread back, haha.

thanks again!

12 Dec 2010, 8:25 AM
#13
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

alright, so using the

UPDATE products SET products_qty_box_status = 0;

sql patch works great, except it turned off the quantity box in the shopping cart. i need it on there, but off everywhere else.. any other good tricks?

12 Dec 2010, 9:59 AM
#14
terrydean avatar

terrydean

New Zenner

Join Date:
Dec 2010
Location:
san francisco, i think?
Posts:
19
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

ok, i got what i wanted. this is what i did-

this is the code for the Add to Cart taken from tpl_product_info_display.php

<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>
            <?php
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
            if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
              // hide the quantity box and default to 1
              $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            } else {
              // show the quantity box
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->

i took out the part in red, which got rid of the "Add to cart:" text, and replaced the "text" in orange to "hidden".
saved them into my override folder and now i no longer have the fields in my product pages, but still have them in my cart! yay!

26 Apr 2011, 1:24 AM
#15
gmrm avatar

gmrm

Zen Follower

Join Date:
Apr 2009
Location:
Oxford UK
Posts:
192
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

This is what i did as the code seems to have changed and mine is different than yours. i just added the // (in red) to uncomment that line

// show the quantity box
// $the_button = '<li id="cartAddInfoText">' . PRODUCTS_ORDER_QTY_TEXT . '</li><li id="cartAddInfoInput">' . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" />' .

6 May 2011, 11:31 PM
#16
lam_cs avatar

lam_cs

New Zenner

Join Date:
Mar 2011
Posts:
28
Plugin Contributions:
0

Re: How to remove Add to Cart quantity from product info page?

Just to say, this is an awesome thread guys, very informative and cut out a lot of hassle.

Not all threads on this forum are this informative and efficient and I wish there was a similar benchmark for all threads, here!

:bigups: