Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39
  1. #21
    Join Date
    Jun 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Add to cart button

    Found it.

    Open
    /public_html/YOURSTORE/includes/templates/YOUR TEMPLATE OVERIDES/templates/tpl_product_info_display.php

    Changing text in RED to the path to your template file.

    I copied the whole section of add to cart code from
    <!--bof Add to Cart Box -->
    to
    <!--eof Add to Cart Box-->

    and pasted it between
    <!--eof Category Icon -->

    Paste here (as shown in RED below)

    <br clear="all" />

    <!--bof Main Product Image -->

    And I now have two Add to Cart buttons, with this mod there will be one at the top of the page. If you only wanted one, the original code could be removed.

    *********************************************

    <!--bof Category Icon -->
    <?php if ($module_show_categories != 0) {?>
    <?php
    /**
    * display the category icons
    */
    require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
    <?php } ?>
    <!--eof Category Icon -->


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


    <br clear="all" />


    <!--bof Main Product Image -->
    <?php
    if (zen_not_null($products_image)) {
    ?>
    <?php
    /**
    * display the main product image
    */
    require($template->get_template_dir('/tpl_modules_main_product_jquery_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_jquery_image.php'); ?>
    <?php
    }
    ?>
    <!--eof Main Product Image-->

    Hope this helps

  2. #22
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    160
    Plugin Contributions
    0

    Default Re: Add to cart button

    This REALLY helped me! THANK YOU! :)

  3. #23
    Join Date
    Aug 2008
    Posts
    38
    Plugin Contributions
    0

    Default Re: Add to cart button

    I have made it so that I have 2 Add to Cart buttons, which I want in most instances on my site. Alot of the time my products have alot of attributes and I wanted the customer to be able to add to cart at the top of them and below them.

    ie:

    See here.
    http://www.nappyshoppe.com/store/hap...per-p-187.html

    However, there are some situations where I only want one add to cart button. When there are no attributes. I am not sure how to write the code to check for if there are attributes, only show the top add to cart box and hide the bottom one.

    Like here.
    http://www.nappyshoppe.com/store/fli...rts-p-645.html

    Thanks in advance for any help.

    Sharni

  4. #24
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Add to cart button

    You could check to see if the product has attributes with a function in the functions_lookups.php for:
    Code:
    /*
     *  Check if product has attributes values
     */
      function zen_has_product_attributes_values($products_id) {
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #25
    Join Date
    Aug 2010
    Posts
    32
    Plugin Contributions
    0

    Default Re: Add to cart button

    Ok So I'm Having some trouble with this. I'm trying to make it where my pictures are on top of the description along with the add button and product details no matter what I do it is not working. I'm using a pure green template. I have set the <br> codes to remove and it is still not working? Some one please help. Thank You.

  6. #26
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default Re: Add to cart button

    Quote Originally Posted by Ajeh View Post
    You could check to see if the product has attributes with a function in the functions_lookups.php for:
    Code:
    /*
     *  Check if product has attributes values
     */
      function zen_has_product_attributes_values($products_id) {


    How would you implement using this code.

    Do you use the line you quoted, or all of the function as follows:

    /*
    * Check if product has attributes values
    */
    function zen_has_product_attributes_values($products_id) {
    global $db;
    $attributes_query = "select sum(options_values_price) as total
    from " . TABLE_PRODUCTS_ATTRIBUTES . "
    where products_id = '" . (int)$products_id . "'";

    $attributes = $db->Execute($attributes_query);

    if ($attributes->fields['total'] != 0) {
    return true;
    } else {
    return false;
    }
    }


    I have my add to cart button located in tpl_modules_attributes.php in order to get the look I wanted. I now have some products that do not have any attributes so tpl_modules_attributes.php is not being called and therefore neither is my add to cart.

    Therefore if I could check for attributes and then call the add to cart only when attributes are not present (in the file tpl_shopping_cart_default.php) it would be very helpful.

    All attempts of inserting your code breaks the cart, could you provide some advice?
    Thank You

  7. #27
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Changing the Add to cart button

    Sorry, my bad ...

    You could use:
    Code:
    if (zen_has_product_attributes($_GET['products_id'])) {
    // show second button code
    }
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #28
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default Re: Changing the Add to cart button

    I do not understand where to use this in the code, it renders the text exactly as you stated on the product page unless I wrap it with

    <?php ?>
    I tried this:


    <php
    if (zen_has_product_attributes($_GET['products_id'])) {
    // show second button code
    }

    <!--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-->
    ?>





    Then it shows the add to cart and ?>



    Then it still shows on products that have attributes and products that do not have attributes. Could you clue me in on where I am going wrong?

    Thanks

  9. #29
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default Re: Changing the Add to cart button

    oops, I added the question mark and moved the bracket to the bottom, but then I got a blank page?

  10. #30
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Changing the Add to cart button

    To make the Add to Cart code not show when there are attributes, take out that code and change the one line:
    Code:
    if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
    to read:
    Code:
    if (zen_has_product_attributes($_GET['products_id']) || CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
    and the Add to Cart button will not show ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Changing add to cart button
    By mdo82 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 15 Nov 2013, 06:38 PM
  2. how to add the add-to-cart-button to the new products box on the home page?
    By ebloger in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 10 Nov 2008, 10:30 AM
  3. Having Trouble changing only the "Add to Cart' button...
    By aruleal in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Oct 2008, 04:12 PM
  4. Changing Add to Cart Button Name
    By embreak in forum Basic Configuration
    Replies: 2
    Last Post: 15 Jan 2008, 10:36 AM
  5. changing add to cart button
    By willjoe86 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 May 2006, 02:02 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR