The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

main cart not updating in safari

maxmax Member
in Help edited January 2013
hi,

im building a store with a persistant mini cart. items are silently added to the cart and the mini-cart value is updated.
the main cart lives on its own page in an iframe.

however sometimes (in safari and mobile safari only) the main cart does not update. the min-cart acknowledges the items, but the main cart says its empty.

the one thing that seems to fix this,
1. i have 3 items in the mini-cart, but the main cart says empty
2. browsing directly to the cart page at mystore.foxycart.com/cart. that page says the cart is empty
3. go back to my site, and now the mini-cart is also empty.
4. then things seem to work

screenshot of items in mini cart but not main cart:
http://cl.ly/image/1M3A3V0A0J0j

any thoughts?

thank you,
max

Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @max - could you upload your site online somewhere? Without actually being able to see the code it's hard to tell you what might be going on.
  • fc_adamfc_adam FoxyCart Team
    edited January 2013
    @max {in response to whisper}

    Try changing this line in your main.js file:
    jQuery.getJSON(href + '&output=json&callback=?', function(data){
    

    To this:
    jQuery.getJSON(href + fcc.session_get() + '&output=json&callback=?', function(data){
    

    And see if that fixes it.
  • maxmax Member
    @fc_adam

    thanks, but that did not fix it.
    the only thing that seems to fix it (temporarily) is to go to mystore.foxycart.com/cart then go back to my store.
  • fc_adamfc_adam FoxyCart Team
    @max,

    I'm unable to replicate what you're seeing at all in Safari on Windows, but I am seeing it on my iPhone. I think what's happening is that you're loading the cart in the iFrame, but you're running into a cookie/session issue where the iFrame isn't picking up the session from your site - so it's loading a blank cart. What you'll need to do is make sure that your cart iFrame source is set to include the fcsid session in it's URL.

    Essentially you would achieve it similar to how you did above - append "fcc.session_get()" onto the cart URL. That way the cart will be loaded with your current session.
  • maxmax Member
    thanks @fc_adam

    can you give me any more advice on how to append "fcc.session_get()" to the url.
    im assuming you mean i should append it to the url on the iframe (not the main windows url).
    right now the iframe is hardcoded in the page which is served via php. the iframe looks like this:
    <iframe class="cart" src="https://moodnyc.foxycart.com/cart"; onLoad="fcc.events.cart.postprocess.execute();" frameborder="0"></iframe>
    

    it also seems odd that it is only happening some of the time in safari and mobile safari?

    thanks
  • fc_adamfc_adam FoxyCart Team
    edited January 2013
    @max,

    It will probably come down to how the individual browser is handling third-party cookies.

    For your iFrame - you could actually set it's src variable to blank in your PHP and then set the src in your javascript.

    So wherever your javascript dictates to load in the cart page, after it's loaded in, set the iFrame like this:
    jQuery("iframe.cart").attr("src", "https://"; + storedomain + "/cart?" + fcc.session_get());
    
  • thanks a lot @fc_adam

    that seems to have fixed it!

    with one edit, the forum seems to have put in an extra semicolon afters the "https://"; the the javascript!
    i tried to post the updated code here, but the semicolon is getting added in.. strange
  • fc_adamfc_adam FoxyCart Team
    @max,

    Yeah that semicolon thing is from the forums - it's trying to be smart about URLS's but it gets in the way a little when it comes to code blocks.
Sign In or Register to comment.