| Line 129... |
Line 129... |
| 129 |
cartItems[sku.toString()]=itemDetail;
|
129 |
cartItems[sku.toString()]=itemDetail;
|
| 130 |
}else{
|
130 |
}else{
|
| 131 |
totalCartValue = totalCartValue - (cartItems[sku.toString()].quantity * cartItems[sku.toString()].unitprice) + (unitPrice * newVal);
|
131 |
totalCartValue = totalCartValue - (cartItems[sku.toString()].quantity * cartItems[sku.toString()].unitprice) + (unitPrice * newVal);
|
| 132 |
if(newVal==0){
|
132 |
if(newVal==0){
|
| 133 |
$("div.cartdetailscard[data-id='"+sku+"']").parent().addClass('hidden');
|
133 |
$("div.cartdetailscard[data-id='"+sku+"']").parent().addClass('hidden');
|
| 134 |
delete cartItems[sku.toString()];
|
134 |
//delete cartItems[sku.toString()];
|
| 135 |
}else{
|
135 |
}else{
|
| 136 |
cartItems[sku.toString()].quantity = newVal;
|
136 |
cartItems[sku.toString()].quantity = newVal;
|
| 137 |
cartItems[sku.toString()].unitprice = unitPrice;
|
137 |
cartItems[sku.toString()].unitprice = unitPrice;
|
| 138 |
}
|
138 |
}
|
| 139 |
|
139 |
|
| Line 150... |
Line 150... |
| 150 |
cartDetailsObj.shippingCharges = shippingCharges;
|
150 |
cartDetailsObj.shippingCharges = shippingCharges;
|
| 151 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
151 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 152 |
}
|
152 |
}
|
| 153 |
$('.cartitemstotal span.itemstotal').text('₹ '+numberWithCommas(totalCartValue));
|
153 |
$('.cartitemstotal span.itemstotal').text('₹ '+numberWithCommas(totalCartValue));
|
| 154 |
$('.cartitemstotal span.shippingval').text('₹ '+numberWithCommas(shippingCharges));
|
154 |
$('.cartitemstotal span.shippingval').text('₹ '+numberWithCommas(shippingCharges));
|
| - |
|
155 |
var payable = 0;
|
| 155 |
if(shippingCharges>0){
|
156 |
if(shippingCharges>0){
|
| - |
|
157 |
if(totalCartValue>0){
|
| 156 |
$('.cartitemstotal').removeClass('hidden');
|
158 |
$('.cartitemstotal').removeClass('hidden');
|
| - |
|
159 |
payable = parseInt(shippingCharges)+parseInt(totalCartValue);
|
| - |
|
160 |
}
|
| 157 |
}else{
|
161 |
}else{
|
| - |
|
162 |
payable = parseInt(totalCartValue);
|
| 158 |
$('.cartitemstotal').addClass('hidden');
|
163 |
$('.cartitemstotal').addClass('hidden');
|
| 159 |
}
|
164 |
}
|
| 160 |
$('.cartgrandtotal span.pull-right').text('₹ '+numberWithCommas(parseInt(shippingCharges)+parseInt(totalCartValue)));
|
165 |
$('.cartgrandtotal span.pull-right').text('₹ '+numberWithCommas());
|
| - |
|
166 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 161 |
});
|
167 |
});
|
| 162 |
|
168 |
|
| 163 |
function numberWithCommas(x) {
|
169 |
function numberWithCommas(x) {
|
| 164 |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
170 |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
| 165 |
}
|
171 |
}
|