Jquery stripped out of my cached template

cmoralescmorales Member
in Help edited April 2013
Hello,

I have a custom checkout template for my site. I mix my code and the "sample" code to apply my style to foxy cart. In my header, I have this:
<!-- BEGIN FOXYCART FILES -->
<link rel="stylesheet" href="//cdn.foxycart.com/static/scripts/colorbox/1.3.23/style4/colorbox.css?ver=1" type="text/css" media="screen" charset="utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//cdn.foxycart.com/calicospanish/foxycart.colorbox.js?ver=2" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="resources/foxy-cart-1.1.0.css" type="text/css" media="screen" charset="utf-8" />

<!-- END FOXYCART FILES -->

However, when I cache that template, I get this:
<!-- BEGIN FOXYCART FILES -->
<link rel="stylesheet" href="//cdn.foxycart.com/static/scripts/colorbox/1.3.23/style4/colorbox.css?ver=1" type="text/css" media="screen" charset="utf-8" />

<script src="//cdn.foxycart.com/calicospanish/foxycart.colorbox.js?ver=2" type="text/javascript" charset="utf-8"></script>
(...pulled code...)

Note how the ajax.googleapis... line is missing.

I am using 1.1
Comments
  • fc_adamfc_adam FoxyCart Team
    @cmorales,

    We automatically include jQuery on the cart, checkout and receipt templates - and including it a second time will generally break things - so we strip that out on the checkout.
  • I see.

    How can I solve this error? It seems that jQuery is not ready yet when colorbox is loaded.

    ReferenceError: jQuery is not defined

    http://cdn.foxycart.com/calicospanish/foxycart.colorbox.js?ver=2
  • fc_adamfc_adam FoxyCart Team
    @cmorales,

    Do you actually need the FoxyCart javascript file on the checkout? If you're not using it, then we'd recommend not including it. That said though - simply make sure that any CSS files are include *before* any of your javascript files, as the jQuery included on the checkout is included after the last CSS file or the title tag - whichever is last.
  • Thanks for your help.
Sign In or Register to comment.