Subversion Repositories SmartDukaan

Rev

Rev 17819 | Rev 17831 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17819 Rev 17827
Line 31... Line 31...
31
		});
31
		});
32
		cartDetailsObj.cartItems = cartItems;
32
		cartDetailsObj.cartItems = cartItems;
33
		localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
33
		localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
34
		$(".pmfooter").removeClass('hidden');
34
		$(".pmfooter").removeClass('hidden');
35
	}else{
35
	}else{
-
 
36
		$.each(cartDetailsObj.cartItems, function(key,val) {
-
 
37
			var newUnitPrice = $(".number-spinner button[data-id='"+key+"']").data('price');
-
 
38
			if(newUnitPrice!=undefined){
-
 
39
				$(".number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
-
 
40
				if(parseInt(newUnitPrice)!=parseInt(val.unitprice)){
-
 
41
					totalCartValue = totalCartValue - (parseInt(val.unitprice)*parseInt(val.quantity)) + (parseInt(newUnitPrice)*parseInt(val.quantity));
-
 
42
					priceChangeMap[key] = newUnitPrice;
-
 
43
				}
-
 
44
			}
-
 
45
		});
36
		$(".pmfooter span.carttotalval").text('0');
46
		$(".pmfooter span.carttotalval").text('0');
37
		$(".pmfooter span.badge").text('0');
47
		$(".pmfooter span.badge").text('0');
38
		$(".pmfooter").addClass('hidden');
48
		$(".pmfooter").addClass('hidden');
39
	}
49
	}
40
	}
50
	}
Line 119... Line 129...
119
			totalCartValue = totalCartValue + (unitPrice * newVal);
129
			totalCartValue = totalCartValue + (unitPrice * newVal);
120
			cartItems[sku.toString()]=itemDetail;
130
			cartItems[sku.toString()]=itemDetail;
121
		}else{
131
		}else{
122
			totalCartValue = totalCartValue - (cartItems[sku.toString()].quantity * cartItems[sku.toString()].unitprice) + (unitPrice * newVal);
132
			totalCartValue = totalCartValue - (cartItems[sku.toString()].quantity * cartItems[sku.toString()].unitprice) + (unitPrice * newVal);
123
			if(newVal==0){
133
			if(newVal==0){
124
				delete cartItems[sku.toString()];
134
				//delete cartItems[sku.toString()];
125
			}else{
135
			}else{
126
				cartItems[sku.toString()].quantity = newVal;
136
				cartItems[sku.toString()].quantity = newVal;
127
				cartItems[sku.toString()].unitprice = unitPrice;
137
				cartItems[sku.toString()].unitprice = unitPrice;
128
			}
138
			}
129
			
139