Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

The universal solution "Continue Shopping Button"

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-07-2008, 01:15 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default The universal solution "Continue Shopping Button"

UPDATE: 22-10-2008

1. Edit file cart.php, after next lines:

PHP Code:
...........
x_session_register("dhl_ext_country_store");
x_session_register("ga_track_commerce");
x_session_register("initial_state_orders", array());
x_session_register("initial_state_show_notif""Y");
x_session_register("enter_as_anonymous"false); 

add next lines:

a) return to the last page;
PHP Code:
#back URL when cont. shoping:
x_session_register("back_url");
if (
$mode == "add")
{
    
$back_url $_SERVER['HTTP_REFERER'];
}

$smarty->assign("back_url"$back_url); 



b) Is it any chance to send customers back into ROOT directory instead of subcategory? - Yes

PHP Code:
#back URL when cont. shoping:

x_session_register("back_url");
if (
$mode == "add")
{
    
$back_url $_SERVER['HTTP_REFERER'];

    
$id intval($productid);
    if (
$id>0) {
        
$cat_path func_query_first_cell("select categoryid_path from $sql_tbl[products_categories]$sql_tbl[categories] where (productid = $id)and(main='Y')and($sql_tbl[products_categories].categoryid=$sql_tbl[categories].categoryid)");
        if (!empty(
$cat_path)) {
            
$cats_path split("/ *",$cat_path);        
            if (!empty(
$cats_path[0])) {
                
$back_url "home.php?cat=".$cats_path[0];
            }
        }
    }
}
$smarty->assign("back_url"$back_url); 

c) Is it any chance to send customers back into PRODUCT category? - Yes

PHP Code:
#back URL when cont. shoping:

x_session_register("back_url");
if (
$mode == "add")
{
    
$back_url $_SERVER['HTTP_REFERER'];

    
$id intval($productid);
    if (
$id>0) {
        
$cat_path func_query_first_cell("select categoryid_path from $sql_tbl[products_categories]$sql_tbl[categories] where (productid = $id)and(main='Y')and($sql_tbl[products_categories].categoryid=$sql_tbl[categories].categoryid)");
        if (!empty(
$cat_path)) {
            
$cats_path split("/ *",$cat_path);        
            if (!empty(
$cats_path[0])) {
                
$last end($cats_path);
                
$back_url "home.php?cat=".$last;
            }
        }
    }
}
$smarty->assign("back_url"$back_url); 

2. Edit URL for "Continue Shopping Button", exm. for Fast Lan Check Out:
Edit file: "skin1/modules/Fast_Lane_Checkout/home_main.tpl", change line:
PHP Code:
<td>{include file="modules/Fast_Lane_Checkout/big_button.tpl" button_title=$lng.lbl_continue_shopping style="button" href="home.php"}</td

replaced by this code

PHP Code:
<td>{include file="modules/Fast_Lane_Checkout/big_button.tpl" button_title=$lng.lbl_continue_shopping style="button" href="`$back_url`"}</td




PS. I would be grateful for any comments on that decision. It should almost always work.
Reply With Quote

The following 5 users thank Yurij for this useful post:
am2003 (07-11-2010), chamberinternet (07-02-2009), gb2world (01-10-2011), successco (05-24-2010), zoro (10-10-2009)
  #2  
Old 05-07-2008, 01:21 AM
 
junaid junaid is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 96
 

Default Re: The universal solution "Continue Shopping Button"

would like to confirm, would this take user back to last page or category page from product was added.
__________________
xcart 4.18 on linux
Reply With Quote
  #3  
Old 05-07-2008, 01:27 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: The universal solution "Continue Shopping Button"

Quote:
Originally Posted by junaid
would like to confirm, would this take user back to last page or category page from product was added.

It must return to the page that was where you click "add to cart" (no difference where it happened (cat. page, product page, search page, some sort or page numbers option... or... some else))
Reply With Quote
  #4  
Old 05-07-2008, 03:46 AM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default Re: The universal solution "Continue Shopping Button"

As to whether this will work at all I don't know, haven't had the time to try it as am presently overloaded. It looks as though it should work though.

But depending on how your cart is set up, I would consider adding some restrictions to "if ($mode == "add")".
In my case for example, I have the ability to "add to cart" from the actual cart page, so I would add the restriction that if I am already on that page, the
back_url variable shouldn't change. There might be other cases where you don't want the variable changed, in which case you should add these restrictions as well.


__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #5  
Old 05-07-2008, 05:01 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: The universal solution "Continue Shopping Button"

Quote:
Originally Posted by xsurf
As to whether this will work at all I don't know, haven't had the time to try it as am presently overloaded. It looks as though it should work though.

But depending on how your cart is set up, I would consider adding some restrictions to "if ($mode == "add")".
In my case for example, I have the ability to "add to cart" from the actual cart page, so I would add the restriction that if I am already on that page, the
back_url variable shouldn't change. There might be other cases where you don't want the variable changed, in which case you should add these restrictions as well.



You can show the modification of your shop?
Reply With Quote
  #6  
Old 05-07-2008, 05:09 AM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default Re: The universal solution "Continue Shopping Button"

PM sent
__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #7  
Old 05-07-2008, 05:58 PM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default Re: The universal solution "Continue Shopping Button"

I tried it on 4.0.19 with ezCheckout (home_checkout.tpl), but it didn't work.
Instead of getting the URL, I get a literal '$back_url'
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
Reply With Quote
  #8  
Old 05-08-2008, 12:00 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: The universal solution "Continue Shopping Button"

Quote:
Originally Posted by imexhouse
I tried it on 4.0.19 with ezCheckout (home_checkout.tpl), but it didn't work.
Instead of getting the URL, I get a literal '$back_url'

Show your code to insert variable {$back_url} in the button "Continue shopping"?
Reply With Quote
  #9  
Old 05-08-2008, 12:21 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: The universal solution "Continue Shopping Button"

Quote:
Originally Posted by xsurf
PM sent

Interesting changed "X-Cart".

You can add an additional condition to determine the condition "back_url".


PHP Code:
strpos($_SERVER['HTTP_REFERER'], "cart.php")>

PS. All options modifications "X-Cart", is not provided.
Reply With Quote
  #10  
Old 05-08-2008, 07:04 AM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default Re: The universal solution "Continue Shopping Button"

I have my own Continue Button gif:

<a href="`$back_url`"><img src="{$ImagesDir}/ContinueShopping.gif" border="0" align="absmiddle" alt="Continue Shopping"></img></a>

and I did add the code below to cart.php

#back URL when cont. shoping:
x_session_register("back_url");
if (
$mode == "add")
{
$back_url = $_SERVER['HTTP_REFERER'];
}

$smarty->assign("back_url", $back_url);


Are the single quote signs in `$back_url` the characters to the left of 1 on the keyboard, or are they actually single quotes that reside on the same key as double quotes?

This is the actual link from the Continue Shopping:

http://www.aquasanacanada.com/%60$back_url%60
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:26 PM.

   

 
X-Cart forums © 2001-2020