Custom continue shipping / back button

joefranksjoefranks Member
in Help edited March 2011

Working on configuring our cart templates and am trying to include a "continue shopping" link on the standard *non-colorbox* cart template.

I have it working fine with the suggested jquery .attr("href","javascript:history.back(-1)") but, if I end up modifying the cart contents, removing product, updating quantities etc and then hit the continue shopping link it the ".back(-1)" is pointing to the cart submission request instead of the original referrer. So I get a "resubmit post data?" and come back to the cart template.

Looks like the cancel & continue button on the checkout template actually has the referring url hardcoded into it, is that available on the cart template as well somehow? Does that make sense?

  • fc_adamfc_adam FoxyCart Team
    Unfortunately not. Unless I'm missing something that someone else will jump in and suggest, one (probably more advanced option) would be to create a cookie when the cart loads in javascript (there is a jQuery plugin for it) for the referring url. Essentially you'd check the referring URL on each page load, and if it doesn't begin with your foxycart store address, then store it and you can use it for your cancel and continue shopping link.

    Obviously this is only really needed if your customers could come from multiple different URL's. If its just one URL you could just hardcode the link (I know that's probably obvious - just being thorough :) )
  • okay, thanks for the follow up. Cookie may work fine there, I will mess around with that at and see how it goes. We may end up with the color box anyway so it could not be an issue.
  • brettbrett FoxyCart Team
    That's a good question, @joefranks. Currently I think the cookie or cart session parameter approach would work, but it (adding a cancel/continue link to the cart) is something we'll consider in a future version of the cart.
  • I've also been looking for a solution for exactly this situation. How do you guys do it in the checkout template? Do you get it out of the session variable? I couldn't find in the documentation where that might be held. Furthermore, is there any place where I can view the default cart/checkout templates? Or are those intentionally hidden from prying eyes?!

    I'll go the cookie route if nothing else works, but if you have a snippet that already does this in the checkout template, I'd love to check it out. Thanks as always!
  • lukeluke FoxyCart Team
    Hey Billy: We used to provide the cart and checkout templates as HTML files but since they are dynamically generated, that value of that quickly diminished. The quickest way to get to it is to setup a quick test store and view source on the output.

    Do you have any suggestions on how we should implement something for this? Going with the session variables seems like the easiest way to keep it flexible.
  • For my purposes, I guess I just need to know where that referrer URL is held in the session JSON (if that's where it is). Does this documentation include all the standard fields available? I don't see the referrer URL:

    Using the example on that page, could it be as easy as:

    jQuery.getJSON('https://'+storedomain+'/cart?'+fcc.session_get()+'&output=json&callback=?', function(cart) {
    var referrer = cart.referrer_url;
    console.log('<a href=\"'+referrer+'\">Continue Shopping</a>');
  • lukeluke FoxyCart Team
    It's not currently stored in the json because that's not the standard implementation. We actually discourage using a full page cart. Is there a reason you're using a full page cart instead of the modal cart? We feel the modal cart is the best user experience as it most closely resembles how people shop in the real world. By forcing them to leave the page completely and go somewhere else, it just confuses the "where do I go next?" question.
  • The Sitemason standard implementation has a live cart on the page, and when users are ready to checkout or update their cart, they are taken to a full page cart where they can update/remove and then checkout. I'll whisper you some examples. Maybe that should be different, but either way I think you answered my question... do it with cookies! Out of curiosity, how do you all do it with the checkout template? Do you use the cookie method or, if it's not in the JSON, store the referrer somewhere on the backend related to the session id?
  • lukeluke FoxyCart Team
    Hey @billywhite4. We rolled out a change today in 072 that adds a page_referrer item to the cart json. That should allow you to do a full page cart and still link back to the correct page.

    Hope that helps.
Sign In or Register to comment.