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

Continue Shopping button that returns customer to catagory

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-22-2008, 09:26 AM
 
mmonaco mmonaco is offline
 

Advanced Member
  
Join Date: Sep 2005
Posts: 33
 

Default Continue Shopping button that returns customer to catagory

I hope I didn't reinvent the wheel here, but i couldn't find anything on search.

This is how I made the "Continue Shopping" button on the fast lane checkout screen return the customer to the last catagory they viewed:

Change to /modules/Fast_Lane_Checkout/home_main.tpl I changed the URL in this line:

<td>{include file="modules/Fast_Lane_Checkout/big_button.tpl" button_title=$lng.lbl_continue_shopping style="button" href="home.php?cat=$catreturn"}</td>


Added to /cart.php at the top of all the x_session_register lines.

#added for Continue Shopping Button
x_session_register("catreturn");
$smarty->assign("catreturn", $catreturn);


Added to /products.php at the top, below the first set of comments.

#added for Continue Shopping Button
x_session_register("catreturn");
$catreturn = $cat;
x_session_save("catreturn");
$smarty->assign("catreturn", $catreturn);

Now i don't know if i did it right, but it seems to work for me on 4.1.9. It doesn't return the customer to the catagory if they search for a product directly, but I think it will serve the purpose, and it's easy. Feel free to clean the code if it's dirty.
__________________
Matt Monaco
X-Cart Gold Plus 4.7.9
Reply With Quote
  #2  
Old 04-24-2008, 01:00 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Continue Shopping button that returns customer to catagory

Quote:
Originally Posted by mmonaco
I hope I didn't reinvent the wheel here, but i couldn't find anything on search.

This is how I made the "Continue Shopping" button on the fast lane checkout screen return the customer to the last catagory they viewed:

Change to /modules/Fast_Lane_Checkout/home_main.tpl I changed the URL in this line:

<td>{include file="modules/Fast_Lane_Checkout/big_button.tpl" button_title=$lng.lbl_continue_shopping style="button" href="home.php?cat=$catreturn"}</td>


Added to /cart.php at the top of all the x_session_register lines.

#added for Continue Shopping Button
x_session_register("catreturn");
$smarty->assign("catreturn", $catreturn);


Added to /products.php at the top, below the first set of comments.

#added for Continue Shopping Button
x_session_register("catreturn");
$catreturn = $cat;
x_session_save("catreturn");
$smarty->assign("catreturn", $catreturn);

Now i don't know if i did it right, but it seems to work for me on 4.1.9. It doesn't return the customer to the catagory if they search for a product directly, but I think it will serve the purpose, and it's easy. Feel free to clean the code if it's dirty.

I think that will not work in the transition from the search product, product page and other possible locations (except for the category PAGE).

I would remembers the urls of the user arrived and then would return it back.

PS. Not remembered page list of products, the type of sorting.
Reply With Quote
  #3  
Old 04-29-2008, 04:40 PM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default Re: Continue Shopping button that returns customer to catagory

Just an FYI, if you want an easy way to go back to where you came form for any reason (when ticking button), i suggest using the most simple method out there...

Quote:
{include file="buttons/button.tpl" button_title=$lng.lbl_go_back style="button" href="javascript:history.go(-1)"}

Keep in mind that is an example, but in your case you have a cart button for continue shopping, so you would want to pull the java out and use that on the existing button...

Quote:
href="javascript:history.go(-1)"

Note the value -1. this can be changed to as many steps back as you wish, so if you need to go back two or three, simply change value to -2 or -3.
__________________
vs 4.1.12
Reply With Quote
  #4  
Old 04-30-2008, 12:21 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Continue Shopping button that returns customer to catagory

Quote:
Originally Posted by markwhoo
Just an FYI, if you want an easy way to go back to where you came form for any reason (when ticking button), i suggest using the most simple method out there...



Keep in mind that is an example, but in your case you have a cart button for continue shopping, so you would want to pull the java out and use that on the existing button...



Note the value -1. this can be changed to as many steps back as you wish, so if you need to go back two or three, simply change value to -2 or -3.

This method does't work always and not everywhere, but is the simplest
Reply With Quote
  #5  
Old 04-30-2008, 11:54 AM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default Re: Continue Shopping button that returns customer to catagory

OK, in almost all cases, lol.

For example, if you open a link in another window, then it will not work. If you page hop via java to another section, and the browser did not keep track of a link clicked, then it will not work.

However, it will work if the browser is able to track what the URL is that you have clicked no matter how many links you follow.

The way it operates (Yurji I am sure you already know this, but adding it for others that may not), is your surfing history to make it the simplest description I suppose.

But it is the most simple method for a button to go back to accomplish what you wish to accomplish in this situation IF, you do not open a link into another window to see what is on the page.


I just thought I would offer this up since this poor guy looks as if he is really chopping at the code to get something as simple as this continue shopping button to work as he wishes it to.


Sometimes it is the simplest things that work the best, and in xcart, I have seen so many folks really over complicate things at times.


Anyhow... There you go hope it helps. If not, it may be used in another solution for you I am sure, and will be a good code snippet for something in the future.
__________________
vs 4.1.12
Reply With Quote
  #6  
Old 04-30-2008, 12:21 PM
 
mmonaco mmonaco is offline
 

Advanced Member
  
Join Date: Sep 2005
Posts: 33
 

Default Re: Continue Shopping button that returns customer to catagory

Quite honestly I posted this code because to my knowledge no other solution has been offered to address this besides the java code, and many consider it flaky. This feature was the number 2 request on our Wholesale website, number 1 being a catalog entry module. I put in both of these for the new site, and wanted to share some of what I did for anyone who would like to use it.

Really the idea came from here:

http://forum.x-cart.com/showthread.php?t=31860&highlight=continue+shopping

Matt
__________________
Matt Monaco
X-Cart Gold Plus 4.7.9
Reply With Quote
  #7  
Old 04-30-2008, 12:57 PM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default Re: Continue Shopping button that returns customer to catagory

To be honest, I think the guy in the other post was speaking of what I referred to as 'if browser does not have the URL history' and then the snippet I posted will not work, and that was what I think Yurij was referring to in response here.

Nothing wrong with either, but it does depend on where the location of the go back or continue button is being used.

For my case, the history go back works quite well due to my wishing to send the user back to the location they were adding items. Now you can send them to the category (like I do) or the exact product.

IF, they have opened in a new window, it will not work, but what will happen is they will either reload what they already have, or can be sent back to home page (store front end).

My reply was not to down what you posted at all, quite honestly there is always more way to skin a cat than one, lol.

My posting was to simply show an easier way of placing a person back where they were with a little easier code snippet.

I seen you mentioned you had not seen anything stating how to achieve what you wanted, and I remembered I seen a posting a long time ago referring to something like I posted, but keep in mind this forum is relatively new (when looking at the big picture of xcart history), and the forum was changed to this format, and a lot of mods and postings were dropped in the transfer to this one.

So, I could not remember if the one I posted was dropped (from being on old forum) or if it was buried in the new one somewhere.


Anyhow, your posting was a good one, it was a bit more intense, and will not work in a lot of settings, but the simple one will in most cases, but not ALL.

Both of them have short comings I guess, but it was just food for thought, not wanting to take away from your posting at all.

You were trying to share, and I was just wanting to give you an alternative that may work in a broader scope if you will.
__________________
vs 4.1.12
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 06:42 PM.

   

 
X-Cart forums © 2001-2020