Skip to content
Snippets Groups Projects
Commit 9a860318 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Cart checkstyles.

parent 42dfaeaf
No related merge requests found
......@@ -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(){
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment