Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Separating Quantity Box and Add to Cart button

Separating Quantity Box and Add to Cart button

Locked

Views: 960

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
15 Sep 2010, 6:22 PM
#1
k8ee avatar

k8ee

New Zenner

Join Date:
Sep 2009
Location:
Ontario, Canada
Posts:
23
Plugin Contributions:
0

Separating Quantity Box and Add to Cart button

Ok, I think I am really close to achieving what I'm looking for, but I need the help of someone with a little more knowledge. The idea is to have the Qty: Box above the product attributes, and then once they have completes the attributes section the 'add to cart' would be located at the bottom. Here is an image to illustrate this:

Here is a link to where the actually page is: http://www.12stepjewelry.com/atgwholesale/index.php?main_page=product_info&cPath=65_69&products_id=553

At this point I've only duplicated the entire Add to Cart Box section. I've tried fooling around with the code so that it hides the button at the top and the box at the bottom, but it always loads as a blank page.

Anyone with a link to a thread that talks about this or anyone with any suggestions would be my hero.

15 Sep 2010, 8:10 PM
#2
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,787
Plugin Contributions:
21

Re: Separating Quantity Box and Add to Cart button

is this what you're after?

it took me 60 seconds to do it so don't look at the styling... the quantity field can be done as one div and button as another and then you can do anything you want with it.

this is what you have to do:

  • open your tpl_product_info_display.php
  • find where you want to position the quantity field
  • insert this code:```
<!--bof Quantity 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']);
        }
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

?>

<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAddQuantity">
<?php
  echo $display_qty;
  echo $display_button;
        ?>
      </div>
<?php } // display qty and button ?> <?php } // CUSTOMERS_APPROVAL == 3 ?> <!--eof Quantity Box-->
- now find where you want to position the button and add this code: ```
<!--bof Add to Cart Button 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 = zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
    <div id="cartAdd">
    <?php
      echo $display_button;
            ?>
          </div>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Button Box-->

As you can see, I created a new div called cartAddQuantity for the quantity field. Create a new id (#cartAddQuantity) in your stylesheet.css and style it as you like.

Have fun! Let us know how it went...

16 Sep 2010, 2:53 PM
#3
k8ee avatar

k8ee

New Zenner

Join Date:
Sep 2009
Location:
Ontario, Canada
Posts:
23
Plugin Contributions:
0

Re: Separating Quantity Box and Add to Cart button

Oh Wow, you are truly my hero. I kinda knew that was what I was supposed to do... I'm just not there yet in being able to put all the peices together. Thanks so much for this fantastic solution.

You are the best ever! Thanks!:clap: