diff --git a/themes/bootstrap/js/cart.js b/themes/bootstrap/js/cart.js index f73c7924bb7f576d846e4595f38972da3546b409..7d937f86fd03469c102c738c8f58f664dfba0edc 100644 --- a/themes/bootstrap/js/cart.js +++ b/themes/bootstrap/js/cart.js @@ -52,15 +52,6 @@ function addItemToCart(id,source) { $('#cartItems strong').html(parseInt($('#cartItems strong').html(), 10)+1); return true; } -function uniqueArray(op) { - var ret = []; - for(var i=0;i<op.length;i++) { - if(ret.indexOf(op[i]) < 0) { - ret.push(op[i]); - } - } - return ret; -} function removeItemFromCart(id,source) { var cartItems = getCartItems(); var cartSources = getCartSources(); @@ -86,10 +77,10 @@ function removeItemFromCart(id,source) { var oldSources = cartSources.slice(0); cartSources.splice(sourceIndex,1); // Adjust source index characters - for(var i=cartItems.length;i--;) { - var si = cartItems[i].charCodeAt(0)-65; + for(var j=cartItems.length;j--;) { + var si = cartItems[j].charCodeAt(0)-65; var ni = cartSources.indexOf(oldSources[si]); - cartItems[i] = String.fromCharCode(65+ni)+cartItems[i].substring(1); + cartItems[j] = String.fromCharCode(65+ni)+cartItems[j].substring(1); } } if(cartItems.length > 0) { @@ -104,6 +95,16 @@ function removeItemFromCart(id,source) { } return false; } +function uniqueArray(op) { + var ret = []; + for(var i=0;i<op.length;i++) { + if(ret.indexOf(op[i]) < 0) { + ret.push(op[i]); + } + } + return ret; +} + function registerUpdateCart($form) { if($form) { $("#updateCart, #bottom_updateCart").unbind('click').click(function(){