Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007
    Posts
    27
    Plugin Contributions
    0

    Default 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?m...&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:

    Code:
    <!--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-->

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default 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.

  3. #3
    Join Date
    Nov 2007
    Posts
    27
    Plugin Contributions
    0

    Default 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.

 

 

Similar Threads

  1. v151 Add To Cart displaying alt text instead of add to cart button
    By AquaticAddiction in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Feb 2014, 07:58 PM
  2. v139h custom 'add selected items to cart' button
    By skylab001 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Apr 2012, 02:29 AM
  3. Add To Cart Button and text
    By ryanb4614 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 31 May 2008, 09:14 AM
  4. Add add to cart button to main page items?
    By ekat in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 11 Oct 2006, 02:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg