View Single Post
  #69  
Old 08-23-2006, 05:45 AM
 
mikalou mikalou is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 71
 

Default Re: Continue Shopping

I have a solution that▓s based on the JavaScript history function (javascript: history.go(-1)) that some of the other solutions in this thread used. This will always take you back to the previous page which, logically, should always be the page you just clicked the ⌠add to cart■ button. So, if you clicked on the ⌠add to cart■ button from the home page, then selecting the ⌠continue shopping■ button will take you back to the home page. If you clicked on the ⌠add to cart■ button from a category page it will take you back to that category page. etc. The ⌠continue shopping■ button will only appear when a product was just added to the cart. So for instance, if you click on the ⌠View Cart■ link in the minicart from the home page, then the ⌠continue shopping■ button won▓t appear.

Step1: Edit: /cart.php

In the code:
Code:
if($mode=="add" and $productid) { if($config["General"]["redirect_to_cart"]=="Y") { func_header_location("cart.php?");
Revise to:
Code:
if($mode=="add" and $productid) { if($config["General"]["redirect_to_cart"]=="Y") {func_header_location("cart.php?mode=added");

Step 2: Edit: /skin1/customer/main/cart.tpl

Change:
Code:
{include file="buttons/continue_shopping.tpl"}

To:
Code:
{if $smarty.get.mode eq 'added'} {include file="buttons/continue_shopping.tpl"} {/if}
Short explanation of what▓s happening so far. We▓re using a smarty function to check the query string to see if the value ⌠mode■ is set to ⌠added■. If it is, then the ⌠continue shopping■ button is displayed.

Step 3: Create a file: skin1/buttons/continue_shopping.tpl
Code:
{include file="buttons/button.tpl" button_title=$lng.lbl_continue_shopping href=$href|default:"javascript: history.go(-1);" title=$title style=$style js_to_href="Y"}
In this code, we▓re using the JavaScript function to send the customer back one page. Logically, this should be the page the customer just clicked the ⌠add to cart■ button.
__________________
X-Cart Gold 4.2.2 - 3.1.19
Reply With Quote