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
  #21  
Old 05-26-2008, 10:23 PM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default 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
__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #22  
Old 05-26-2008, 10:33 PM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default 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)) 
__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #23  
Old 05-27-2008, 12:34 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
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.
Reply With Quote
  #24  
Old 05-27-2008, 12:59 AM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default 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.
__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #25  
Old 06-19-2008, 11:12 PM
 
EN4U EN4U is offline
 

eXpert
  
Join Date: Feb 2008
Location: AZ
Posts: 379
 

Default 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.....
__________________
Regards, Dan
X-Cart Gold Version 4.1.10

1 - One page checkout
2 - Image Generator
3 - CSDEO Pro
4 - Shop By Price
5 - Next - Previous
6 - On Sale
7 - Shop By Price

8 - Froogle & Google Base Feed
9 - Buy Together
10 - Customer Loyalty Points
11 - Customer Reward Points
Customer Reward Points Referral Add-on
12 - Product Reviews
13 - Other Custom Modifications
----------------------
http://www.townsqjewelry.com/
http://www.eroticnights4u.com/ <---- Adult Oriented - Toys
Reply With Quote
  #26  
Old 06-20-2008, 03:32 AM
 
xsurf xsurf is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 56
 

Default 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
__________________
X-cart Gold 4.1.12
One Page Checkout
CDSEO Pro
Smart Search
PHP 5.2.5
FreeBSD
Reply With Quote
  #27  
Old 06-20-2008, 04:08 AM
 
EN4U EN4U is offline
 

eXpert
  
Join Date: Feb 2008
Location: AZ
Posts: 379
 

Default 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
__________________
Regards, Dan
X-Cart Gold Version 4.1.10

1 - One page checkout
2 - Image Generator
3 - CSDEO Pro
4 - Shop By Price
5 - Next - Previous
6 - On Sale
7 - Shop By Price

8 - Froogle & Google Base Feed
9 - Buy Together
10 - Customer Loyalty Points
11 - Customer Reward Points
Customer Reward Points Referral Add-on
12 - Product Reviews
13 - Other Custom Modifications
----------------------
http://www.townsqjewelry.com/
http://www.eroticnights4u.com/ <---- Adult Oriented - Toys
Reply With Quote
  #28  
Old 06-26-2008, 03:51 PM
 
Stizerg Stizerg is offline
 

Senior Member
  
Join Date: Apr 2008
Location: Sydney, Australia
Posts: 195
 

Default 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!
__________________
X-Cart Gold Plus 4.6.6
A lot of custom mods
Reply With Quote
  #29  
Old 06-26-2008, 07:10 PM
 
EN4U EN4U is offline
 

eXpert
  
Join Date: Feb 2008
Location: AZ
Posts: 379
 

Default 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...
__________________
Regards, Dan
X-Cart Gold Version 4.1.10

1 - One page checkout
2 - Image Generator
3 - CSDEO Pro
4 - Shop By Price
5 - Next - Previous
6 - On Sale
7 - Shop By Price

8 - Froogle & Google Base Feed
9 - Buy Together
10 - Customer Loyalty Points
11 - Customer Reward Points
Customer Reward Points Referral Add-on
12 - Product Reviews
13 - Other Custom Modifications
----------------------
http://www.townsqjewelry.com/
http://www.eroticnights4u.com/ <---- Adult Oriented - Toys
Reply With Quote
  #30  
Old 06-27-2008, 08:07 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"

It was written in 30 minutes.

Test on the original X-Cart (4.1.9) without any modifications.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:07 AM.

   

 
X-Cart forums © 2001-2020