Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,268
    Plugin Contributions
    3

    Default Re: Add Checkout button to product page

    Actually, while this can be done, there is no logic to it.

    The Product Info page is there to ADD a product to a cart. If you also have a button that goes to checkout, then your shoppers could go to checkout "by accident", and before they have a chance to ADD the product they are currently viewing...

    They will be offered TWO buttons. Either they:-

    1. ADD the product on display to the cart, OR
    2. Don't add it - but go to checkout

    You would do better to invoke the shopping cart sidebox and put some buttons in there. I have done this, with the sidebox to show ONLY when there is something in the cart, and ONLY when not on the shopping cart main page.

    GO HERE and add the product you see to the cart, then look at the top left column.

    Tell me if this is a better idea.

    If you are determined to have the button on the INFO page (which I think is a bad idea) then the following code in tpl_product_info_display.php may be what you are after:

    PHP Code:
    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>    
    <div id="checkoutOnInfoPage"><?php echo '<a href="' zen_href_link(FILENAME_CHECKOUT_SHIPPING'''SSL') . '">' zen_image_button(BUTTON_IMAGE_CHECKOUTBUTTON_CHECKOUT_ALT) . '</a>'?></div>
    <?php
     
    }
    ?>
    The above DIV is given a style ID of checkoutOnInfoPage, allowing you set a style in the CSS.
    20 years a Zencart User

  2. #2
    Join Date
    Apr 2008
    Location
    Flint, Michigan
    Posts
    687
    Plugin Contributions
    0

    Default Re: Add Checkout button to product page

    Quote Originally Posted by schoolboy View Post
    Actually, while this can be done, there is no logic to it.

    The Product Info page is there to ADD a product to a cart. If you also have a button that goes to checkout, then your shoppers could go to checkout "by accident", and before they have a chance to ADD the product they are currently viewing...

    They will be offered TWO buttons. Either they:-

    1. ADD the product on display to the cart, OR
    2. Don't add it - but go to checkout

    You would do better to invoke the shopping cart sidebox and put some buttons in there. I have done this, with the sidebox to show ONLY when there is something in the cart, and ONLY when not on the shopping cart main page.

    GO HERE and add the product you see to the cart, then look at the top left column.

    Tell me if this is a better idea.

    If you are determined to have the button on the INFO page (which I think is a bad idea) then the following code in tpl_product_info_display.php may be what you are after:

    PHP Code:
    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>    
    <div id="checkoutOnInfoPage"><?php echo '<a href="' zen_href_link(FILENAME_CHECKOUT_SHIPPING'''SSL') . '">' zen_image_button(BUTTON_IMAGE_CHECKOUTBUTTON_CHECKOUT_ALT) . '</a>'?></div>
    <?php
     
    }
    ?>
    The above DIV is given a style ID of checkoutOnInfoPage, allowing you set a style in the CSS.
    Yes! Your site with sidebox will work! I am using the Shopping cart sidebox. It does not have edit cart button. How did you add code to your sidebox?

    You have really nice site! I like way it is lay out and colors.

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,268
    Plugin Contributions
    3

    Default Re: Add Checkout button to product page

    This is a quick and easy "hack" that you can use to put the buttons into the shopping cart sidebox.

    Steps:

    1. create TWO small image buttons called button_edit_cart.gif and button_checkout_sm.gif
    .

    If you like, you can COPY those little images off my site's sidebox using these URL's:
    Code:
    http://www.modshops.co.uk/demoshop/includes/templates/your_template/buttons/english/button_edit_cart.gif
    and
    Code:
    http://www.modshops.co.uk/demoshop/includes/templates/your_template/buttons/english/button_checkout_sm.gif
    2. SAVE those images to: includes/templates/kim/buttons/english/

    3. Open the following file for editing:

    includes/templates/template_default/sideboxes/tpl_shopping_cart.php

    right at the bottom you will see:

    PHP Code:
      $content .= '</div>';
    ?> 
    Just underneath the $content .='</div>';

    add this:

    PHP Code:
      $content .= '<div id="checkoutButton"><center><a href="index.php?main_page=shopping_cart"><img src="includes/templates/kim/buttons/english/button_edit_cart.gif" alt="Edit Cart" title=" Edit Cart " width="61" height="20" /></a>&nbsp;<a href="index.php?main_page=checkout_shipping"><img src="includes/templates/kim/buttons/english/button_checkout_sm.gif" alt="Checkout" title=" Checkout " width="61" height="20" /></a></center></div>'
    ... so you get:

    PHP Code:
       $content .= '</div>';
      
    $content .= '<div id="checkoutButton"><center><a href="index.php?main_page=shopping_cart"><img src="includes/templates/kim/buttons/english/button_edit_cart.gif" alt="Edit Cart" title=" Edit Cart " width="61" height="20" /></a>&nbsp;<a href="index.php?main_page=checkout_shipping"><img src="includes/templates/kim/buttons/english/button_checkout_sm.gif" alt="Checkout" title=" Checkout " width="61" height="20" /></a></center></div>';
      
    ?> 
    You should actually SAVE this to your custom template system (kim), so you have it in...

    includes/templates/kim/sideboxes/tpl_shopping_cart.php
    20 years a Zencart User

  4. #4
    Join Date
    Apr 2008
    Location
    Flint, Michigan
    Posts
    687
    Plugin Contributions
    0

    Default Re: Add Checkout button to product page

    Quote Originally Posted by schoolboy View Post
    This is a quick and easy "hack" that you can use to put the buttons into the shopping cart sidebox.

    Steps:

    1. create TWO small image buttons called button_edit_cart.gif and button_checkout_sm.gif
    .

    If you like, you can COPY those little images off my site's sidebox using these URL's:
    Code:
    http://www.modshops.co.uk/demoshop/includes/templates/your_template/buttons/english/button_edit_cart.gif
    and
    Code:
    http://www.modshops.co.uk/demoshop/includes/templates/your_template/buttons/english/button_checkout_sm.gif
    2. SAVE those images to: includes/templates/kim/buttons/english/

    3. Open the following file for editing:

    includes/templates/template_default/sideboxes/tpl_shopping_cart.php

    right at the bottom you will see:

    PHP Code:
      $content .= '</div>';
    ?> 
    Just underneath the $content .='</div>';

    add this:

    PHP Code:
      $content .= '<div id="checkoutButton"><center><a href="index.php?main_page=shopping_cart"><img src="includes/templates/kim/buttons/english/button_edit_cart.gif" alt="Edit Cart" title=" Edit Cart " width="61" height="20" /></a>&nbsp;<a href="index.php?main_page=checkout_shipping"><img src="includes/templates/kim/buttons/english/button_checkout_sm.gif" alt="Checkout" title=" Checkout " width="61" height="20" /></a></center></div>'
    ... so you get:

    PHP Code:
       $content .= '</div>';
      
    $content .= '<div id="checkoutButton"><center><a href="index.php?main_page=shopping_cart"><img src="includes/templates/kim/buttons/english/button_edit_cart.gif" alt="Edit Cart" title=" Edit Cart " width="61" height="20" /></a>&nbsp;<a href="index.php?main_page=checkout_shipping"><img src="includes/templates/kim/buttons/english/button_checkout_sm.gif" alt="Checkout" title=" Checkout " width="61" height="20" /></a></center></div>';
      
    ?> 
    You should actually SAVE this to your custom template system (kim), so you have it in...

    includes/templates/kim/sideboxes/tpl_shopping_cart.php

    Thank you! Thank you! It looks so much better!

    Kim

 

 

Similar Threads

  1. v139h Multiple product images covering Add to Cart button on product page
    By lolwaut in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 7 Jan 2014, 06:39 AM
  2. Add button that leads to new page on product page
    By naz1228 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 26 Sep 2010, 01:48 PM
  3. Add an add to cart button under each product quantity on the category page
    By buxton1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Apr 2010, 06:37 PM
  4. how to put a add to cart button on every product in product listing page??
    By lastpirate007 in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 11 Sep 2007, 05:47 AM
  5. add button in product listing page
    By dannyd in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 6 Feb 2007, 05:41 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