How to change json scripts when upgrading

kanjigirlkanjigirl Member
in Help edited April 2011
Hi,

I'm upgrading FoxyCart for a client - first from 0.6 to 0.7, then I'll deal with 0.7.1. We have two sections of custom code using json that FoxyCart support has helped us with over the last year - I don't what if anything I need to do to modify them for 0.7. Can you help? I'm not a programmer so I don't follow what's shown in the JS upgrade info page very well.

These snippets are both in checkout.html.

This was added to the head section to keep the shipping country restriction we needed from failing and has worked fine:
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function(){
// Ensure the GA info is in the URL //
if (window.location.hash.search(/utma/) == -1 && typeof(fc_json.custom_fields['ga']) != "undefined") {
if (fc_json.custom_fields['ga'].length > 0) {
window.location.hash = fc_json.custom_fields['ga'];
}
}
});
</script>

This was added because we were having problems with Google Analytics integration:
<script type="text/javascript">
// Ensure the GA info is in the URL //
if (window.location.hash.search(/utma/) == -1 && fc_json.custom_fields['ga'].length > 0) {
	window.location.hash = fc_json.custom_fields['ga'];
}
try {
var pageTracker = _gat._getTracker("UA-8921152-1");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._setAllowAnchor(true);
pageTracker._trackPageview('/checkout');
} catch(err) {}
</script>

Can you tell me what I need to do to these to get them ready for 0.7/0.7.1?
Comments
  • lancelance Member, Community Support Member
    @kanjigirl -

    From what I can see here, the existing jQuery should work for you. The only place this touches the JSON object is where you are calling fc_json.custom_fields and that is still a valid call in 0.7.0.

    Lance
  • Thank you. I did the upgrade and most things seem to be working - I submitted two tickets for the items that aren't, but they don't seem to be related to the JSON code at all.
Sign In or Register to comment.