Hi, I've been at this bit of code for a while, but am not sure what I'm doing wrong. Basically I want to create a loop that prints out all items in a cart. If I take the loop out, it prints the item just added, but when I add the loop in, it breaks.
I'm not too familiar with jQuery/JSAON, so if anyone could point out where I might be going wrong, that would be great.
(edit - full js files)
var ShoppCartAjaxHandler = function (cart) {
(function($) {
var display = $('#shopp-cart-ajax');
display.empty().hide(); // clear any previous additions
var item = $('<ul class="sidecart_list"></ul>').appendTo(display);
$.each(cart.items, function() {
$("<li></li>").html("<strong>"+this.quantity+"</strong>"+this.name).appendTo(item);
});
//$('<li></li>').html('<strong>'+cart.Item.quantity+'</strong> x '+cart.Item.name).appendTo(item);
$('<li></li>').html('<strong>Subotal</strong> '+asMoney(cart.Totals.subtotal)).appendTo(item);
$('<li></li>').html('<strong>Shipping</strong> '+asMoney(cart.Totals.shipping)).appendTo(item);
$('<li></li>').html('<strong>Total</strong> '+asMoney(cart.Totals.total)).appendTo(item);
if ($('#shopp-cart-items').length > 0) {
$('#shopp-cart-items').html(cart.Totals.quantity);
$('#shopp-cart-total').html(asMoney(cart.Totals.total));
} else {
$('.widget_shoppcartwidget p.status').html('<p class="status_info"><strong><span id="shopp-cart-items">'+cart.Totals.quantity+'</span></strong> x <span id="shopp-cart-total">'+cart.Item.name+'</span></p><p class="status_info"><strong>Subtotal</strong> <span id="shopp-cart-subtotal">'+asMoney(cart.Totals.subtotal)+'</span></p><p class="status_info"><strong>Shipping</strong> <span id="shopp-cart-shipping">'+asMoney(cart.Totals.shipping)+'</span></p><p class="status_info"><strong>Total</strong> <span id="shopp-cart-total">'+asMoney(cart.Totals.total)+'</span></p>');
}
display.slideDown();
})(jQuery)
}