type:
snippet
category:
Misc cart and checkout
name:
Showing the "minicart" on cart and checkout
versions:
0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0
reference:
http://forum.foxycart.com/comments.php?DiscussionID=2573&page=1
tags:
Advance, Snippets, cart and checkout
date:
2011-05-27

Showing the "minicart" on cart and checkout

Try sticking this above your </body> or towards the end of your page :

<script type="text/javascript" charset="utf-8">
	function fc_CurrencyFormatted(amount) {
		var i = parseFloat(amount);
		if(isNaN(i)) { i = 0.00; }
		var minus = "";
		if(i < 0) { minus = "-"; }
		i = Math.abs(i);
		i = parseInt((i + .005) * 100);
		i = i / 100;
		s = new String(i);
		if(s.indexOf(".") < 0) { s += ".00"; }
		if(s.indexOf(".") == (s.length - 2)) { s += "0"; }
		s = minus + s;
		return s;
	}
 
	jQuery(document).ready(function(){
		// hide #fc_minicart if product_count = 0. css() rather than hide() for jQuery+Safari
		(fc_json.product_count > 0) ? jQuery("#fc_minicart").show() : jQuery("#fc_minicart").css("display","none");
		// update values
		jQuery("#fc_quantity").html("" + fc_json.product_count);
		jQuery("#fc_total_price").html("" + fc_CurrencyFormatted(fc_json.total_price));
	})
</script>

Site Tools