X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   The universal solution "Continue Shopping Button" (https://forum.x-cart.com/showthread.php?t=39603)

Yurij 05-07-2008 01:15 AM

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.

junaid 05-07-2008 01:21 AM

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.

Yurij 05-07-2008 01:27 AM

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)) :)

xsurf 05-07-2008 03:46 AM

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.



Yurij 05-07-2008 05:01 AM

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? :)

xsurf 05-07-2008 05:09 AM

Re: The universal solution "Continue Shopping Button"
 
PM sent

imexhouse 05-07-2008 05:58 PM

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'

Yurij 05-08-2008 12:00 AM

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"?

Yurij 05-08-2008 12:21 AM

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. :)

imexhouse 05-08-2008 07:04 AM

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


All times are GMT -8. The time now is 03:49 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.