Sidebar Cart not Load.. redirects to cart page instead

I'm having trouble loading the sidebar cart. Sometimes sidebar cart loads, but after a split second it redirected to the cart page. I tried it here as an example. Codes i got from Sample Code of the Admin section, here's the link: http://50.28.44.72/crossjewelers/2.0/index.php

Even that sample code doesn't work. What did i do wrong? Thank you.
Comments
  • fc_adamfc_adam FoxyCart Team
    edited September 26
    @aerosko0315,

    Thanks for posting the link - I can see what you're describing there.

    The issue here is related to a javascript error that is interrupting the Sidecart initialization and causing it to fall back to behaving as a normal link - redirecting to a new page. The error is specifically related to the Sidecart though, as the Twig template ends up as single line, so semi-colons at the end of script lines becomes important for it to function.

    Looking at your custom code included in the "cart include" template - I see two lines that are missing a semi-colon:
    offset = -5.0
    monthNames: [
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
    "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
    ]
    If you add a semicolon to both that offset line and to after the closing square bracket for "monthNames" - I believe that should get it working for you.

    As an aside - we generally recommend including custom scripts in your store's configuration - within the "Add custom header and footer code to your templates" option. If you move the custom code from the "cart include" to the "footer" of that configuration option, it will still be included for you on the cart, checkout and receipt. The benefit though is that you can reset the "cart include" template to be back to the default template - to ensure you get any updates we release for that template.
  • @fc_adam

    I have tested it already by removing the custom script i added in cart include but the side bar cart still won't work. I have removed it now. I set cart include into the default template but the issue still exist. I didn't add yet the custom script. Thanks
  • fc_adamfc_adam FoxyCart Team
    @aerosko0315,

    Trying out your test page you linked to above now, Sidecart is working when I click the add to cart. Potentially you were still seeing the cached version of the javascript on your page, so it was still breaking even after removing the custom code. Does it work for you now? If not - could you confirm what browser you're using?
Sign In or Register to comment.