I'm using the code below, but I'm having one little problem - the cart page always takes me back to the category and never to the product detail page. I replaced $HTTP_GET_VARS with $_GET and put that part in the init.php instead of config.php. Any ideas?
Quote:
Originally Posted by xgarb
Going from inthepink's code I did this...
create a tpl. file in buttons called continue_shopping.tpl
add the following code to it...
Code:
{* source: http://forum.x-cart.com/viewtopic.php?t=1124 *}
{if $goto eq "product" and $last_productid neq ""}
{assign var="href" value="`$WebDir`product.php?productid=`$last_productid`"}
{elseif $last_cat neq ""}
{assign var="href" value="`$WebDir`home.php?cat=`$last_cat`"}
{else}
{assign var="href" value="`$http_location`"}
{/if}
{include file="buttons/button.tpl"
button_title="Continue Shopping" style="button" href="$href"}
add to config.php....
Code:
x_session_register("last_cat");
x_session_register("last_productid");
if($HTTP_GET_VARS['cat'] != "")
{
$last_cat = $cat;
}
if($HTTP_GET_VARS['productid'] != "")
{
$last_productid = $productid;
}
$smarty->assign("last_productid", $last_productid);
$smarty->assign("last_cat", $last_cat);
You can then use....
Code:
{include file="buttons/continue_shopping.tpl"}
whereever you like to give you a continue shopping button. I've got it next to the checkout button and also below 'Your shopping cart is empty'
sweet!
|