![]() |
Continue Shopping
I did a search on every way I could think of but didn't find anything. I need to add a button in the catalog that says Continue Shopping after you have added items to your cart. Any ideas on how I can do this? I want it to take you back to where you where last shopping.
|
Theres a couple of things that you could do ...
Either unset Redirect customer to cart in general settings to stop the customer giong to the view catr page when they add a product or create a new button file called continue_shopping.tpl that contains the following code. Quote:
the (-2) part is how many steps you wish to take them backwards. (-1) would take them back to the last product detail page or (-2) would move them back 2 steps and thus go to the products list page. Now where ever you want that to appear just add this code ... Quote:
Its not perfect but it does the job most of the time |
Which is best practice? To send them to cart when they "add" or not to send them to cart?
|
up to you I suppose but I reckon its best to show them the cart after choosing a product just so that they know its been added and dont try and add it again
|
Ok I am feeling pretty stupid about right now, where do I need to put the code to call this? I am not sure which file is getting called to display what you are seeing after adding a product.
|
if you switch on the debug console in your admin area you should see what tpl files are being loaded for each page.
Im pretty sure that want to be looking at cart.tpl though |
Yeah it was, I found it after a little digging, had a brain lock when I was typing. :D
|
Ok, this is a very old post I'm replying to, but I'm thinking of adding "continue shopping" button at the View Cart and Checkout stage.
I have tried to work with by disabling "redirect customer to cart" and although I have three "view Cart" and "checkout" links on our pages, customers seems to be getting confused once they add an item to cart, and when the shop doesn't direct them to a cart iteself after adding that item. I find that surprising but hey, customers are alway right. What I need to do is redirect customers to the Category they were at and not direct them always to the last page they were at. Sometimes a customer will choose to see a product page and than add that product to a cart, or they may add an item using "Buy now" from within the Catagory pages. (-1) setting will redirect them to the last page they were at, which will be fine if they were on Catagory page, but if they added an item at Product page this will redirect them back to that product page. I wish them to be redirected to the Catagory page always. How do I go on about implimenting this? |
TRY THIS...
1:) Create a new button file in /buttons called continue_shopping.tpl that contains the following code: Code:
{include file="buttons/button.tpl" button_title=$lng.lbl_continue_shop} 2:) In Admin go to "languages" edit languages and create a new entry called "lbl_continue_shop" (without the quotes) Now in cart.tpl or where ever you want the button to appear just add this code: DONE! |
I could'nt get these methods to work, so I tried something that is pretty much what was suggested above, but without the tpl file. I just created a label called lbl_continue_shop with text reading Click Here to Continue Shopping and added this code to customer/main/cart.tpl below the checkout and submit labels and below the your shopping cart is empty labels:
{$lng.lbl_continue_shop} This works great for me. |
I ended up doing this after creating that label:
Added this: <TD align="right"> {include file="buttons/button.tpl" button_title=$lng.lbl_continue_shop style="button"} </TD> Right above this: <TD align="right"> {include file="buttons/button.tpl" button_title=$lng.lbl_checkout style="button" href="cart.php?mode=checkout"} </TD> So it uses my button style and lines up right next to it. It also actually loads the front of the store again (my store is small). I wasn't sure I liked the Javascript thing. It works great. |
Brian Peat -
I followed your example - Works Great! Thank you for the post! Personally, I think this should have been in x-cart from the begining.... |
Quote:
For example, if they clicked in the shopping cart link (instead of adding a product) they won't like the two steps history back behaviour. |
Quote:
I had the same dilema. The Continue Shopping should only appear if and only if I added a product. No sense in having a Continue Shopping button if you didn't added a product in the first place. Code:
# Changed redirect to: Code:
func_header_location("cart.php?mode=added"); then before: Code:
func_header_location("cart.php"); added: Code:
if ($mode == "added") $smarty->assign("cshopping","1"); then in cart.tpl, above the checkout button: Code:
{if $cshopping eq "1"} Conditions: Redirect to cart has to be Y. Buy Now code in templates disabled You can only add to cart when viewing product details (or clicking on a particular product). |
Nice!
It seems that it's exactly what I was looking for. I'll implement that soon. Thanks, elomibao |
I made a booboo when posting the solution.
The line: Code:
if ($mode == "added") $smarty->assign("cshopping","1"); should be added before: Code:
if ($mode == "checkout" || $mode == "auth") { and not this line: Code:
func_header_location("cart.php"); Sorry about that. :mrgreen: |
alternative method using sessions
I wanted to be able to have a continue shopping button on any page that would automatically bring the user back to the last category or product they viewed. Obviously using history steps wouldn't work in this case. If anyone is intersted, here is how I did it:
Add this code to the end of config.php Code:
Then create a template similar to this one and save it as "buttons/continue_shopping.tpl": Code:
Include the template anywhere you want to point the customer back to the last category or product they viewed. To send them back to the last product include the template like this: Code:
{include file="buttons/continue_shopping.tpl" goto="product"} For the last department just include it like this: Code:
{include file="buttons/continue_shopping.tpl"} If the customer hasn't visited a department or product yet this sends them back to the homepage. Since this uses sessions, you can use it on any page no matter how many steps away from a department they've traveled. Hope someone finds this useful. Jay |
Hi, eliombao
I made the continue shopping implementation based on what I could grabb from your examples. Instead of using a new $cshopping var I added this line to cart.php: Code:
$smarty->assign("mode",$mode); Code:
# And, of course, I created the buttons/continue_shopping.tpl file. It worked nice but I encountered that when you updated the shopping cart (changed quantity or deleted an item) the historyback-2 is not what you as a customer would expect. So, I tried using a $mode=updated for that cases when you updated your cart after you added a product. It used an historyback-3. It worked great in IE, because one or several reloads of a page is registered in its history as one step, but it doesn't work the same way in Opera. My next attempt was trying to carry the $cat var to remember the category you were on instead of using the history method, but I faced new problems. What would you suggest to me? Should I just dissapear the continue shopping button when you have updated the shopping cart? Or should I use the historyback-3 solution without worrying about the rather minor Opera (and I guess mozilla) issue? Or is there a more or less easy way to use something like Code:
func_header_location("home.php?cat=$cat") Any ideas or suggestions are welcome. |
roccons,
I already tried and tested the solution I posted previously. After adding a product, I updated it several times. After I clicked on Continue Shopping, it redirects me back to the category where I previously clicked a product. As long as the conditions I previously stated has been met, it should work. BTW, I've tried on FireFox 1.0 IE 6 Windows 2003 Windows 2000 Fedora Core 3 RedHat Linux 9 Goodluck! |
You're right, elomibao
You can update as many times as you wish without added history steps (because the action is not really a page reload but a form submition). The problem appears only when deleting items. I finally took this redirect issue with a different approach. I'll post it later. Greetings. |
Elomibao, on that last piece of code you posted ... what tpl did you apply that too ?
Thanks |
Quote:
The last one? cart.php roccons, You're right. The solution I posted will have the Continue Shopping button taken out once a product has been removed from the cart. |
Elomibao - you listed "Redirect" code in an earlier post. Where do I find this code to make the change you suggested?
Thanks, Jennifer |
I've created a mod that uses a redirect landing page which makes it clear the product was added, gives them the option to continue shopping, checkout, and uses the links you set in upselling to encourage them to purchase the related products.
For more information or to demo visit: http://www.websitecm.com/store/customer/product.php?productid=84 |
jkirkpatrick,
In cart.php, look for this chuch of code: Code:
# replace: Code:
func_header_location("cart.php"); with: Code:
func_header_location("cart.php?mode=added"); Jon, Interesting solution. You don't get redirected to a cart but a page that allows you to continue shopping or checkout. There are advantages and disadvantages to this. It's all up to them what to implement. Nice work. :wink: |
well, I think many of these solutions are not working or too complicated. I just added to customer/main/cart.tpl the following code:
Code:
<TD align="right"><TABLE border="0" cellspacing="0" cellpadding="0" onclick="javascript: self.location='home.php'" style="cursor: pointer;" valign="middle"> right above the code Code:
<TD align="right"> it is in around line 99 in my file (version 4.0.11). This is the original xcart code from the invoice page, there is already a Continue Shopping button. Andy |
Your solution only redirects the shopper to the home page. Not exactly what other people wanted. Some people wanted to get redirected to the last Category they shoped from. No sense in going back to the home page and re-clicking the categories to get back to where you came from.
Again, it's up to them what to implement. And I think some of the solutions posted above are pretty straight forward and very easy to implement. |
Well, I wasn't critizising the other solutions, they are actually pretty neat =D> but with some drawbacks.
I just look at this: Quote:
Quote:
Quote:
Why do we assume the visitor want to go back to the same category he came from? We don't know that for sure but we know for sure if he want's to resume shopping he want's to stay in the shop, not in the very first page but in the shop. Again, all solutions may work well in one or another way, to make sure it works in all cases - no matter what browser is used - let them go with a simple link back to the shop start page. I think we all agree: this shouldn't be any matter for a custom mod, this should be included in the standard XC code :) as many other nice and smart solutions we all can find in this forum - it is not my intetion to make any code looking bad, if you and all the other ones felt that way... I apologize, I just wanted to add another, very simple and "works always" solution, Andy |
Sorry if I sound as if I was offended. I wasn't. If you look at my first reply on this thread (located on the first page), there were conditions and situations where I mentioned how shopping should work the way I wanted it. If an x-cart user wanted the same thing, then good. If not, it's good also because there were other solutions that we're available.
It's all good. :mrgreen: |
Easy continue shopping botton
I changed the javascript to go back two pages, using this code, I also inserted this in the same place andreas04031 did just gives me a standard button which takes customer back to Category.
Insert this Code:
<TD align="right"><TABLE border="0" cellspacing="0" cellpadding="0" onclick="javascript: history.go(-2)" style="cursor: pointer;" valign="middle"> Above This in your /customer/main/cart.tpl Code:
<TD align="right"> or if you dont have any mods on cart.tpl just replace cart.tpl with this: Code:
{* $Id: cart.tpl,v 1.74.2.9 2004/12/14 08:24:21 svowl Exp $ *} Thanks to andreas04031 ;) viewable on my store (not live) http://shop.swordmart.co.uk |
This looks like a good solution, but I got a little confused as to what the final code for the redirect section of cart.php should look like. Would it be possible for you to cut and paste the final, edited section altogether?
Thanks for your help! Quote:
|
Quote:
Excelent work.Just a small mistake in the code here "<TD>[img]/{$ImagesDir}/but2.gif[/img]</TD></TR> " it should be "<TD>[img]{$ImagesDir}/but2.gif[/img]</TD></TR> " . I could not get but2.gif because path wasn't right . Hope it helps . |
Suggestion
I would like to suggest guys to implement multiple solutions together to meet the redirect need. Letting customers themself to choose from WHERE to go after adding item to cart.
E.g. In the cart page, show Checkout | Back to Home | Back to Last Category I have not try but it should be a pretty good idea. Anyone have this tested please post the final solution here and share to each other. (I m not a php guy so I have no idea to do it myself). Thanks to all of you who shares here~~ :) |
This is a very simple and handy mod. Thanks for sharing.
Only problem with it is that when you are directed back 2 pages, the items that were added the cart do not appear. I'm afraid this might be confusing to customers. Any way to make the javascript refresh the page after it sends you back 2 pages? TIA! Quote:
|
Continue shopping works.
Thanks Embliano, andreas, and swordfish and all the rest of this great xcart team. It works, and yes no need to create the button its already there. The only thing is the right rounded off edge seems to be missing.
Any one know how to correct this? Again thanks! :lol: As they say, too much information.....should have read "Isleman" post above and saved myself a headache! :D |
Not sure if anyone else had problems implementing elomibao's code, but just in case... here is what I eventually got it working as....
In cart.php, the redirect section should end up like this: Code:
# and further down, the top line in this block needs to be added so you end up with: Code:
if ($mode == "added") $smarty->assign("cshopping","1"); then the tpl mods as previously posted. |
Going from inthepink's code I did this...
create a tpl. file in buttons called continue_shopping.tpl add the following code to it... Code:
{* source: http://forum.x-cart.com/viewtopic.php?t=1124 *} add to config.php.... Code:
x_session_register("last_cat"); You can then use.... Code:
{include file="buttons/continue_shopping.tpl"} whereever you like to give you a continue shopping button. I've got it next to the checkout button and also below 'Your shopping cart is empty' sweet! |
Works GREAT! =D>
Thanks!! |
Thanks Swordfish and andreas04031. Your post worked fine for me in 4.016.
Reference: Posted: Mon Mar 07, 2005 5:52 pm Post subject: Easy continue shopping botton. Small correction on code From Code:
>[img]/{$ImagesDir}/but2.gif[/img] to Code:
>[img]{$ImagesDir}/but2.gif[/img] Cheers Chris |
Quote:
That "/" had me going too! |
All times are GMT -8. The time now is 05:51 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.