-
-
Save adamjudd/a750a52ac8274226e056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fcc.events.cart.postprocess = new FC.client.event(); | |
fcc.events.cart.postprocess.add(function(){ | |
fcc.cart_update(); | |
return "pause"; | |
}); | |
fcc.events.cart.postprocess.add(function(){ | |
buildFullCart(FC.json.products); | |
}); | |
FC.client.prototype.cart_update = function() { | |
var self = this; | |
jQuery.getJSON('https://' + this.storedomain + '/cart.php?cart=get&output=json' + this.session_get() + '&callback=?', function(data) { | |
FC.json = data; | |
if ( ! self.session_initialized == true) { | |
self.session_initialized = true; | |
FC.session_id = data.session_id; | |
self.session_set(); | |
self.session_get(); | |
} | |
// "Minicart" Helpers | |
(FC.json.product_count > 0) ? jQuery("#fc_minicart, .fc_minicart").show() : jQuery("#fc_minicart, .fc_minicart").css("display","none"); | |
// update values | |
jQuery("#fc_quantity, .fc_quantity").html("" + FC.json.product_count); | |
jQuery("#fc_total_price, .fc_total_price").html("" + self._currency_format(FC.json.total_price)); | |
// Execute the ready event on intial pageload, if it's defined | |
if (self.events.cart.ready.counter == 0) { | |
self.events.cart.ready.execute(); | |
} else { | |
self.events.cart.postprocess.resume(); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment