Mini-cart quantity not showing in cart/checkout pages

kanjigirlkanjigirl Member
in Help edited November 2012
I'm not sure if this is a problem or something I should just hide... I have the mini-cart quantity working on all pages in the site, for example:

http://www.redkitecreative.com/projects/kontour/typefaces_axia_samples.html

But when you add an item to the cart, on the cart and checkout pages the quantity stays at 0, it never changes. Is that something that can be changed?

https://kontour.foxycart.com/cart?name=Axia Regular (1%20Style)%20Open%20Type%20Desktop&price=60&category=Fonts&code=Axregular2&quantity_max=1&fcsid=2jo1hnr0nr3apbudlekme0aj30
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @kanjigirl,

    The smarts that update those fields are included in the FoxyCart javascript file you include on your site. As those files aren't included on your cart or checkout, that's why it's not working there. If you include this in your cart and checkout templates, right before the </head> tag, it should work for you:
    <script type="text/javascript">
    jQuery(document).ready(function() {
    	if (fc_json.product_count > 0) {
    		jQuery("#fc_minicart, .fc_minicart").show();
    		if (fc_json.product_count == 1) {
    			jQuery("#fc_plural, .fc_plural").hide();
    			jQuery("#fc_singular, .fc_singular").show();
    		} else {
    			jQuery("#fc_plural, .fc_plural").show();
    			jQuery("#fc_singular, .fc_singular").hide();
    		}		
    	} else {
    		jQuery("#fc_minicart, .fc_minicart").hide();
    	}
    
    	// update values
    	jQuery("#fc_quantity, .fc_quantity").html("" + fc_json.product_count);
    	jQuery("#fc_total_price, .fc_total_price").html("" + currency_format(fc_json.total_price));
    });
    
    currency_format = function(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;
    }
    </script>
    
  • Works perfectly, thank you.
Sign In or Register to comment.