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

Yurij 05-08-2008 07:23 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by imexhouse
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


Use this code... :)
PHP Code:

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


imexhouse 05-08-2008 07:24 AM

Re: The universal solution "Continue Shopping Button"
 
You know, I changed `$back_url` to {$back_url} and added the condition for the http referrer. It's working now - well, sort of - Continue Shopping redirects me to the root:
http://www.aquasanacanada.com

regardless whether the referrer was a product list page, or a product page or homepage.

imexhouse 05-08-2008 07:25 AM

Re: The universal solution "Continue Shopping Button"
 
LOL, we mistimed our messages...
But, still, referred back to homepage.

Yurij 05-08-2008 07:34 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by imexhouse
LOL, we mistimed our messages...
But, still, referred back to homepage.


You are using a modified "X-cart"?

After add product to cart, I turn to page

http://www.aquasanacanada.com/added.php.......

imexhouse 05-08-2008 07:42 AM

Re: The universal solution "Continue Shopping Button"
 
Yeah, it's ezCheckout, ezRecommends and ezUpsell
That added.php file is an encrypted file for the mod.

Yurij 05-08-2008 07:59 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by imexhouse
Yeah, it's ezCheckout, ezRecommends and ezUpsell
That added.php file is an encrypted file for the mod.


Try insert next code in "cart.php"
PHP Code:

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


after next lines:
PHP Code:

if (!empty($active_modules['Wishlist'])) {
    if (
$mode == 'add2wl' || $mode == "wishlist") {
        require 
$xcart_dir."/include/remember_user.php";

    } elseif (!empty(
$login) && !empty($remember_data) && ($mode == 'add2wl' || $mode == "wishlist" || $mode == 'add')) {
        require 
$xcart_dir."/include/remember_user.php";
    }
}

x_load('cart','user','order','tests'); 


Before the call "ezCheckout, ezRecommends and ezUpsell" in cart.php....

The form, when adding product into the card, sends the data on "cart.php? Mode = add".

When done redirection to "added.php", I do not know, because I do not have these modules.

imexhouse 05-08-2008 08:08 AM

Re: The universal solution "Continue Shopping Button"
 
There's no include/rembember_user.php in 4.0.x

Yurij 05-08-2008 08:09 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by imexhouse
There's no include/rembember_user.php in 4.0.x


Show first 20-30 lines your cart.php (i worked with 4.1.9 gold/pro)

PS. Try insert after:

PHP Code:

require "./auth.php";
include 
$xcart_dir."/shipping/shipping.php"


If not help, then I do not know. Without access to code, My thought ended ;)

imexhouse 05-08-2008 08:26 AM

Re: The universal solution "Continue Shopping Button"
 
I appreciate what you're doing anyway.
Let me understand - do you want me to replace the code you provided in the previous post:

Quote:

require $xcart_dir."/include/remember_user.php";


with

Quote:

require "./auth.php";
include
$xcart_dir."/shipping/shipping.php";



So the whole code would look like this:

Quote:


if (!empty($active_modules['Wishlist'])) {
if (
$mode == 'add2wl' || $mode == "wishlist") {
require "./auth.php";
include
$xcart_dir."/shipping/shipping.php";


} elseif (!empty(
$login) && !empty($remember_data) && ($mode == 'add2wl' || $mode == "wishlist" || $mode == 'add')) {
require "./auth.php";
include
$xcart_dir."/shipping/shipping.php";

}
}

x_load('cart','user','order','tests');



Is that the idea?


imexhouse 05-08-2008 08:36 AM

Re: The universal solution "Continue Shopping Button"
 
Well, I inserted the code the way it looks in my last post, but when I click on Add to Cart, I get a blank page.
Don't worry about it. It's not a crucial part of ordering process anyway.

Thanks for all your help.

Jack

xsurf 05-26-2008 10:23 PM

Re: The universal solution "Continue Shopping Button"
 
Well, I finally got around to trying this, and it doesn't work for me, despite having 4.1.9 .
Admittedly, x-cart is installed only as my shopping cart (so the actual "add to cart" button is clicked on from a page outside x-cart, and only then x-cart is entered, directly into the shopping cart) but still I would have thought HTTP_REFERER would contain the correct value?
Yet back_url always ends up being https://www.mysite.com/xcart/cart.php?keep_https=yes

The code I used was
PHP Code:

x_session_register("back_url");
if (
$mode == "add" && strpos($_SERVER['HTTP_REFERER'], "cart.php")>)
{
    
$back_url $_SERVER['HTTP_REFERER'];
}
$smarty->assign("back_url"$back_url); 


And
PHP Code:

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


xsurf 05-26-2008 10:33 PM

Re: The universal solution "Continue Shopping Button"
 
Ah, never mind, fixed it! Looks like it's working for me now - I changed
PHP Code:

if ($mode == "add" && strpos($_SERVER['HTTP_REFERER'], "cart.php")>


to

PHP Code:

if ($mode == "add" && (strpos($_SERVER['HTTP_REFERER'], "cart.php") == false)) 


Yurij 05-27-2008 12:34 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by xsurf
Ah, never mind, fixed it! Looks like it's working for me now - I changed
PHP Code:

if ($mode == "add" && strpos($_SERVER['HTTP_REFERER'], "cart.php")>


to

PHP Code:

if ($mode == "add" && (strpos($_SERVER['HTTP_REFERER'], "cart.php") == false)) 




PHP Code:

if ($mode == "add" && (strpos($_SERVER['HTTP_REFERER'], "cart.php") == false)) 



similarly

PHP Code:

if ($mode == "add" && (strpos($_SERVER['HTTP_REFERER'], "cart.php") == 0)) 



Because if you want to add conditions when the line does not contain some substring, you should write to verify "strpos($_SERVER['HTTP_REFERER'], "cart.php") === false" result for this function.

xsurf 05-27-2008 12:59 AM

Re: The universal solution "Continue Shopping Button"
 
Hi Yurij, I am not exactly sure what you refer to in your last post (?)
The reason I used "== false" instead of "== 0" is because according to its documentation, strpos returns '0' if the substring was at the start of the string, and what I wanted to achieve is that back_url gets an HTTP_REFERER value only when the referrer is not any of the cart.php pages.

For my purposes, I am actually even debating removing the $mode == "add" condition... With the "mode==add" condition, clicking on "Continue Shopping" leads to the last non xcart page on my site from which the visitor added an item to the cart. Removing that condition, clicking on "Continue Shopping" will (I believe) lead to the last non xcart page on my site which the visitor saw (whether they bought something there or not) before the cart.

EN4U 06-19-2008 11:12 PM

Re: The universal solution "Continue Shopping Button"
 
So has anyone had success with this in newest version. This is a major flaw in xcart design imo. My other sites, different platform than this one, that once a mod was purchased to achieve it, brought up sales allot.....So its a major issue with me that i implement it in my store here.

"Continue Shopping" -- Brings the person back to the area when they added the product.

I have Bill's one page checkout and have asked him on this, he said he has no idea how to make it happen.

Any ideas.....

xsurf 06-20-2008 03:32 AM

Re: The universal solution "Continue Shopping Button"
 
I dont know about 4.1.10 , but it worked for me just fine with 4.1.9 with the code I described

EN4U 06-20-2008 04:08 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by xsurf
I dont know about 4.1.10 , but it worked for me just fine with 4.1.9 with the code I described


Awesome... Anyway I can get the completed .tpl for that.

Thanks

Stizerg 06-26-2008 03:51 PM

Re: The universal solution "Continue Shopping Button"
 
Thanks guys! Works on 4.1.10

in Fast_Lane_Checkout/home_main.tpl
HTML Code:

<td><a href="{$back_url}"><img src="{$ImagesDir}/img/continueshopping.png" alt="continue shpopping" /></a>

and in cart.php
PHP Code:

#back URL when cont. shoping:
x_session_register("back_url");
if (
strpos($_SERVER['HTTP_REFERER'], "cart.php") == false)
{
    
$back_url $_SERVER['HTTP_REFERER'];
}
$smarty->assign("back_url"$back_url); 


Well done!

EN4U 06-26-2008 07:10 PM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by Stizerg
Thanks guys! Works on 4.1.10

in Fast_Lane_Checkout/home_main.tpl
HTML Code:

<td><a href="{$back_url}"><img src="{$ImagesDir}/img/continueshopping.png" alt="continue shpopping" /></a>

and in cart.php
PHP Code:

#back URL when cont. shoping:
x_session_register("back_url");
if (
strpos($_SERVER['HTTP_REFERER'], "cart.php") == false)
{
    
$back_url $_SERVER['HTTP_REFERER'];
}
$smarty->assign("back_url"$back_url); 


Well done!



Nice... Only thing that may confuse some is that you will need to make your own "continue shopping" button.... and with the reference above, you'd have to upload it in a folder in "images" called /img/continueshopping.png or what ever name you would want. or as I did, just upload the new button to images and that's it. Then the call would be <img src="{$ImagesDir}/continueshopping.png" alt="continue shopping" /></a>[/html]

The "home_main.tpl" to adjust is in /skin1/modules/Fast_Lane_Checkout (not the other modules folder in root)
The cart.php to add the above code is in your root folder by itself

Be sure to respell shopping(alt) also.....

Works great.. Thanks...

Yurij 06-27-2008 08:07 AM

Re: The universal solution "Continue Shopping Button"
 
It was written in 30 minutes.

Test on the original X-Cart (4.1.9) without any modifications.

EN4U 06-27-2008 08:47 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by Yurij
It was written in 30 minutes.

Test on the original X-Cart (4.1.9) without any modifications.


awesome job , works like a charm....

nft 08-24-2008 06:22 AM

Re: The universal solution "Continue Shopping Button"
 
Hi All,

I have got this working on 4.1.9 and it is certainly better the the default and I will therefore keep using it. Thanks for the mod by the way.

The only additional function missing from this mod is to return to the last category, manufacturer category, home.php or any other page outside of cart.php if the last visited page was not where the product was added to the cart.

Problem Example: A customer has already added a product to the cart, they have continued shopping and then whilst browsing through a category they have decided to view their shopping cart. By clicking on 'Continue Shopping' they will be directed back to the page where their last product was added rather than returning back to the category they were browsing.

I would think that this could be achived with a bit of PHP logic know how.

Does anyone know of a simple way to achieve this?

Regards,

James

bigmaggot 08-24-2008 12:20 PM

Re: The universal solution "Continue Shopping Button"
 
http://forum.x-cart.com/showthread.php?t=873&page=7&highlight=continue+sho pping

junaid 08-26-2008 01:49 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by xsurf
Well, I finally got around to trying this, and it doesn't work for me, despite having 4.1.9 .
Admittedly, x-cart is installed only as my shopping cart (so the actual "add to cart" button is clicked on from a page outside x-cart, and only then x-cart is entered, directly into the shopping cart) but still I would have thought HTTP_REFERER would contain the correct value?
Yet back_url always ends up being https://www.mysite.com/xcart/cart.php?keep_https=yes

The code I used was
PHP Code:

x_session_register("back_url");
if (
$mode == "add" && strpos($_SERVER['HTTP_REFERER'], "cart.php")>)
{
    
$back_url $_SERVER['HTTP_REFERER'];
}
$smarty->assign("back_url"$back_url); 


And
PHP Code:

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



didnt work for me, it sent me directly to shop/home.php .

added code to customer/main/cart.pl & cart.php .
based on instructions this file didnt had buttons in Fast_Lane_Checkout/home_main.tpl .

would appreciate help

imexhouse 09-03-2008 08:44 AM

Re: The universal solution "Continue Shopping Button"
 
If you're using DSEFU and have a hidden product, when you add that product to the shopping cart, your continue shopping button won't work the way it's supposed to.
Hidden products have these url's:

https://www.somedomain.com/product.php?productid=16201&cat=253

DSEFU will convert the php? page into html. Then, if you click on 'Continue Shopping' button, you'll end up with a 404, because the url you're redirected to has this form:

https://www.somedomain.com/Some-Product-p-16201.html&cat=253
and that url does not exist.

Any ideas how to get around it?

Lingerieblowout 09-03-2008 02:23 PM

Re: The universal solution "Continue Shopping Button"
 
Have you looked at

Sorry wrong thread. (edited)

imexhouse 09-03-2008 02:45 PM

Re: The universal solution "Continue Shopping Button"
 
Does anybody have any idea how to get around my problem with hidden products and the continue shopping button solution posted here?

imexhouse 09-09-2008 01:51 PM

Re: The universal solution "Continue Shopping Button"
 
I can't understand why &cat=253 appears at the end of the regular something124-page1.html string...

imexhouse 09-11-2008 03:18 PM

Re: The universal solution "Continue Shopping Button"
 
Yurij,

Perhaps you, as the author of the mod, could tell me why the &cat=253 appears after .html - because I can't figure it out.

Thank you.

Yurij 09-12-2008 12:12 AM

Re: The universal solution "Continue Shopping Button"
 
Quote:

Originally Posted by imexhouse
Yurij,

Perhaps you, as the author of the mod, could tell me why the &cat=253 appears after .html - because I can't figure it out.

Thank you.


I need url to the hidden product on your shop (PM me pls).

PS. I think problem in DSEFU mods but i need check this problem on the real store.


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

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