Forums / General Questions / Use button AND text to add items in cart

Use button AND text to add items in cart

Locked

Views: 973

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
6 Dec 2007, 5:04 AM
#1
justinae avatar

justinae

New Zenner

Join Date:
Nov 2007
Posts:
27
Plugin Contributions:
0

Use button AND text to add items in cart

Currently you can add items to the cart with a "add to cart" button but I also want to have text that actually says "add to cart" and underlines when rolled over. I don't need any css help with the rollover but I can't figure out how to have both the button and the text at the same time.

I'm using the latest zencart

Here is my link: http://www.pedxshoes.com/index.php?main_page=product_info&products_id=7

It's the small white bordered box with the small shopping bag in it.

Here is the code in my tpl_product_info_display.php file:

<!--bof Form start-->
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
<!--eof Form start-->
<!--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-->
6 Dec 2007, 4:46 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Use button AND text to add items in cart

The easiest solution would be to add the text to the button image (it doesn't have to look like it is part of the button); however, this would not have selectable text.
You could use

#cartAdd input+input:hover {border-bottom: 2px solid #666999;}

which would underline the whole button, image and text, on hover.

The input in question is specified as "image" by zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT), and I don't see a way to incorporate a text string in that.

7 Dec 2007, 4:05 AM
#3
justinae avatar

justinae

New Zenner

Join Date:
Nov 2007
Posts:
27
Plugin Contributions:
0

Re: Use button AND text to add items in cart

actually just saving the text as part of the button worked better than i thought it would. thank you for offering your help.