Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37
  1. #1
    Join Date
    May 2006
    Location
    QLD Australia
    Posts
    77
    Plugin Contributions
    0

    Default Can I change the "back to shopping" behaviour?

    I'd like to change the "back to shopping behaviour" on a Zen cart that I'm working on. Currently when you click the back to shopping icon in the checkout you're taken back to the last product you ordered. I would like to go back to the product listing instead. Is this possible?

    I demonstrated the flow to a friend and he pointed out that it didn't make a lot of sense to go back to what you have already ordered, he's got a good point.

    Any help greatly appreciated.

  2. #2
    Join Date
    May 2006
    Location
    QLD Australia
    Posts
    77
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    It appears that this is configurable, I have visited another zen cart store and you return to the home page when you click on the back to shopping icon. I've been pouring through the admin menus but don't seem to find the control. Any suggestions?

    Many thanks

  3. #3
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: Can you change the "back to shopping" behaviour?

    Two ways:

    1. You'll have to edit the button in the template to point back to a product-listing of sorts. This would end up with a hard-coded link back to whichever product-listing screen you code it for.

    or

    2. Either that or you'll need to carefully study the navigation class and its implementation in order to work out the various code changes that will be required to make it work dynamically.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    May 2006
    Location
    QLD Australia
    Posts
    77
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    Hi Dr Byte,

    Thanks for the clue, I've done a bit of programming but not much in PHP so this will be a nice exercise for me. Could you let me know if I'm on the right track with the logic.

    I have looked at the tpl_shopping_cart_.default.php file and have found the variable for the back to shopping link is zen_back_link. What I'm thinking of doing is replacing it with a new path variable called last_category so the line would be:

    <div class="buttonRow back"><?php echo last_category() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?>

    What I would like to do is assign this variable when you enter a category listing page so when you order an item and get taken to the checkout the last category you visited would be in the variable.

    I note the address for the category listing pages are in this format:

    http://domain.com.au/index.php?main_page=index&cPath=4

    where the end number is the category number of the products being shown. I imagine that if I find a variable that contains the category number I should be able to construct the url. Is there such a variable? It would need to be in both the category list and the product detail page.

    Once I have it I'll be able to write some code to construct the url then assign it to my last_category variable. So when you click on the back to shopping icon it should go back to the category page.

    Am I on the right track and can anyone help with the identity of the variables I'm looking for?

    Thanks for your help

  5. #5
    Join Date
    May 2006
    Location
    QLD Australia
    Posts
    77
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    Here's the quick and dirty solution that I've come up with. It involves setting up a template override for the following files:

    includes/templates/template_default/templates/tpl_index_product_list.php and
    includes/templates/template_default/templates/tpl_shopping_cart_default.php

    in the tpl_index_product_list.php insert the following lines of code at line 15 (just above "<div class="centerColumn" id="indexProductList">"

    <!-- start record category being visited adelante /-->
    <!-- reset the session variable /-->
    <?php unset($_SESSION["last_category_visited"]);
    <!--set the variable last category visited wit the current product category number /-->
    session_start();
    $_SESSION["last_category_visited"] = $current_category_id;
    ?>
    <!-- end record category being visited adelante /-->

    in the tpl_shopping_cart_default.php insert the following lines of code at line 130 which is just above "<!--bof shopping cart buttons-->"

    <!-- Generate back to shopping path 04052007 Adelante /-->
    <?php
    $back_shopping_path = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . 'index.php?mainpage=index&cPath=' . $_SESSION["last_category_visited"] .'">' ;

    ?>
    <!--end back to shopping path /-->


    You will also need to change the line

    <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>

    to

    <div class="buttonRow back"><?php echo $back_shopping_path . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>

    How it works:

    A session is set up to record the product category number for the page that is being visited. This is found in the variable $current_category_id and is set to the session variable last_category_visited.

    When you go to the checkout the session variable is read and used in the construction of the url for the category page that was last visited.

    If you login and visit the checkout directly clicking on the back to shopping icon takes you to the home page.

    It would be nice to capture the split page data as well but I haven't found the variables as yet.

    I'd appreciate any inputs or comments that make make this solution more elegant. I hope it is useful to some.

    Many thanks

  6. #6
    Join Date
    Aug 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    Is it possible to change that behavior to a specific url?

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

    Default Re: Can you change the "back to shopping" behaviour?

    You can customize your template for the shopping_cart to go anywhere you like for the Continue Shopping button ...
    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. #8
    Join Date
    May 2006
    Location
    QLD Australia
    Posts
    77
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    You can hard code the button or set the path in the variable $back_shopping_path

  9. #9
    Join Date
    Jun 2005
    Posts
    120
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    thanks for this! just what i needed. and thanks for the thorough explanation too!!

  10. #10
    Join Date
    Jun 2005
    Posts
    120
    Plugin Contributions
    0

    Default Re: Can you change the "back to shopping" behaviour?

    i dont have time right now to do this, but a switch to turn this on or off in admin would be great wouldnt it. you could choose the default behavior of the continue shopping button in the mystore config. go to item or go to category or always go home. something like that and then base the logic around the swich... hmm

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. Can't change the "price" and "Item Name" Link
    By thricelll in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 27 Feb 2011, 08:16 AM
  2. How can I "flip" layout of Back to Shopping button with the Shipping Estimator button
    By MarleneF in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 7 May 2010, 09:38 PM
  3. How can I hide the "back to shopping" button?
    By heheno1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 1 May 2009, 10:56 PM
  4. How can I pre-set the "Back to Shopping"?
    By dhcernese in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 5
    Last Post: 7 Aug 2008, 06:12 PM
  5. How can I change how the "Back" button works/displays?
    By askjv in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Nov 2007, 10:52 PM

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