| Line 12... |
Line 12... |
| 12 |
$(".pmfooter span.badge").text(cartDetailsObj.totalCartQuantity.toString());
|
12 |
$(".pmfooter span.badge").text(cartDetailsObj.totalCartQuantity.toString());
|
| 13 |
$(".pmfooter span.carttotalitemsval").text(cartDetailsObj.totalSkus.toString());
|
13 |
$(".pmfooter span.carttotalitemsval").text(cartDetailsObj.totalSkus.toString());
|
| 14 |
var totalCartValue = cartDetailsObj.totalCartValue;
|
14 |
var totalCartValue = cartDetailsObj.totalCartValue;
|
| 15 |
var priceChangeMap = {};
|
15 |
var priceChangeMap = {};
|
| 16 |
$.each(cartDetailsObj.cartItems, function(key,val) {
|
16 |
$.each(cartDetailsObj.cartItems, function(key,val) {
|
| - |
|
17 |
var newUnitPrice ;
|
| - |
|
18 |
var bulkpricing ;
|
| - |
|
19 |
|
| - |
|
20 |
if($(".number-spinner button[data-id='"+key+"']").length == 0 && $(".button-checkbox button[data-id='"+key+"']").length != 0)
|
| - |
|
21 |
{
|
| - |
|
22 |
newUnitPrice = $(".button-checkbox button[data-id='"+key+"']").data('price');
|
| - |
|
23 |
bulkpricing = $(".button-checkbox button[data-id='"+key+"']").data('bulkpricing');
|
| - |
|
24 |
}
|
| - |
|
25 |
else{
|
| 17 |
var newUnitPrice = $(".number-spinner button[data-id='"+key+"']").data('price');
|
26 |
newUnitPrice = $(".number-spinner button[data-id='"+key+"']").data('price');
|
| 18 |
var bulkpricing = $(".number-spinner button[data-id='"+key+"']").data('bulkpricing');
|
27 |
bulkpricing = $(".number-spinner button[data-id='"+key+"']").data('bulkpricing');
|
| - |
|
28 |
}
|
| - |
|
29 |
|
| - |
|
30 |
|
| 19 |
if (bulkpricing != undefined && bulkpricing.length != 0){
|
31 |
if (bulkpricing != undefined && bulkpricing.length != 0){
|
| 20 |
// bulkpricing = bulkpricing.sort(function(a, b){
|
32 |
// bulkpricing = bulkpricing.sort(function(a, b){
|
| 21 |
// return a.quantity - b.quantity;
|
33 |
// return a.quantity - b.quantity;
|
| 22 |
// });
|
34 |
// });
|
| 23 |
|
35 |
|
| Line 102... |
Line 114... |
| 102 |
cartItems = cartDetailsObj.cartItems;
|
114 |
cartItems = cartDetailsObj.cartItems;
|
| 103 |
}
|
115 |
}
|
| 104 |
var inc = 0;
|
116 |
var inc = 0;
|
| 105 |
var dec = 0;
|
117 |
var dec = 0;
|
| 106 |
// var sku = btn.data('id');
|
118 |
// var sku = btn.data('id');
|
| 107 |
var sku = btn.attr('data-id');
|
119 |
var sku = parseInt(btn.attr('data-id'));
|
| 108 |
var unitPrice = parseInt(btn.attr('data-price'));
|
120 |
var unitPrice = parseInt(btn.attr('data-price'));
|
| 109 |
var prodname = btn.data('name');
|
121 |
var prodname = btn.data('name');
|
| 110 |
var brandname = btn.data('brand');
|
122 |
var brandname = btn.data('brand');
|
| 111 |
var catalogItemId = btn.data('identifier');
|
123 |
var catalogItemId = btn.data('identifier');
|
| 112 |
var minBuyQuantity = btn.data('minquantity');
|
124 |
var minBuyQuantity = parseInt(btn.attr('data-minquantity'));
|
| 113 |
if(minBuyQuantity == "" || minBuyQuantity == undefined){
|
125 |
if(minBuyQuantity == "" || minBuyQuantity == undefined){
|
| 114 |
minBuyQuantity =1;
|
126 |
minBuyQuantity =1;
|
| 115 |
}
|
127 |
}
|
| 116 |
var quantityStep = btn.data('quantitystep');
|
128 |
var quantityStep = parseInt(btn.attr('data-quantitystep'));
|
| 117 |
if(quantityStep == "" || quantityStep == undefined){
|
129 |
if(quantityStep == "" || quantityStep == undefined){
|
| 118 |
quantityStep =1;
|
130 |
quantityStep =1;
|
| 119 |
}
|
131 |
}
|
| 120 |
var bulkpricing = btn.data('bulkpricing');
|
132 |
var bulkpricing = JSON.parse(btn.attr('data-bulkpricing'));
|
| 121 |
|
133 |
|
| 122 |
if (btn.attr('data-dir') == 'up') {
|
134 |
if (btn.attr('data-dir') == 'up') {
|
| 123 |
if ( input.attr('max') == undefined || parseInt(input.val()) < parseInt(input.attr('max')) ) {
|
135 |
if ( input.attr('max') == undefined || parseInt(input.val()) < parseInt(input.attr('max')) ) {
|
| 124 |
// if(parseInt(input.val())<5){
|
136 |
// if(parseInt(input.val())<5){
|
| 125 |
// inc = 1;
|
137 |
// inc = 1;
|
| Line 284... |
Line 296... |
| 284 |
$('.morecoloroptions_'+$(this).data('id')).toggleClass('hidden');
|
296 |
$('.morecoloroptions_'+$(this).data('id')).toggleClass('hidden');
|
| 285 |
});
|
297 |
});
|
| 286 |
|
298 |
|
| 287 |
$(document).on('click','.button-checkbox > .btn',function(){
|
299 |
$(document).on('click','.button-checkbox > .btn',function(){
|
| 288 |
$(this).addClass('active').siblings().removeClass('active');
|
300 |
$(this).addClass('active').siblings().removeClass('active');
|
| - |
|
301 |
$(this).parent().parent().parent().find('.priceshow').addClass('hidden');
|
| - |
|
302 |
$("."+$(this).attr('data-setsetect')).removeClass('hidden');
|
| - |
|
303 |
var bulkpricing = $(this).data("bulkpricing");
|
| 289 |
var cart_details = localStorage.getItem('cart_details');
|
304 |
var cart_details = localStorage.getItem('cart_details');
|
| 290 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").prop("disabled", false);
|
305 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").prop("disabled", false);
|
| 291 |
if(cart_details!=undefined){
|
306 |
if(cart_details!=undefined){
|
| 292 |
var cartDetailsObj = JSON.parse(cart_details);
|
307 |
var cartDetailsObj = JSON.parse(cart_details);
|
| 293 |
var item = cartDetailsObj.cartItems[$(this).data('id')];
|
308 |
var item = cartDetailsObj.cartItems[$(this).data('id')];
|
| Line 296... |
Line 311... |
| 296 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
311 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 297 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
312 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 298 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
313 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 299 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val(item.quantity);
|
314 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val(item.quantity);
|
| 300 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
315 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| - |
|
316 |
|
| - |
|
317 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-minquantity',$(this).data('minquantity'));
|
| - |
|
318 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-bulkpricing',$(this).attr('data-bulkpricing'));
|
| - |
|
319 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-quantitystep',$(this).data('quantitystep'));
|
| - |
|
320 |
|
| - |
|
321 |
if (bulkpricing != undefined && bulkpricing.length != 0){
|
| - |
|
322 |
var bulk_quant = cartDetailsObj.cartItems[$(this).data('id')].quantity;
|
| - |
|
323 |
if(bulk_quant == 0){
|
| - |
|
324 |
$(this).parent().parent().parent().parent().find('.setback').removeClass('setback');
|
| - |
|
325 |
}
|
| - |
|
326 |
|
| - |
|
327 |
for(var i=0;i<bulkpricing.length;i++)
|
| - |
|
328 |
{
|
| - |
|
329 |
if(bulk_quant<bulkpricing[i]['quantity']){
|
| - |
|
330 |
break;
|
| - |
|
331 |
}
|
| - |
|
332 |
else{
|
| - |
|
333 |
$(this).parent().parent().parent().parent().find('.setback').removeClass('setback');
|
| - |
|
334 |
$(this).parent().parent().parent().parent().find('.select'+$(this).data("id")+'a'+bulkpricing[i]['quantity']).addClass('setback');
|
| - |
|
335 |
}
|
| - |
|
336 |
}
|
| - |
|
337 |
}
|
| - |
|
338 |
|
| 301 |
cartDetailsObj.cartItems[$(this).data('id')].unitprice = parseInt($(this).attr('data-price'));
|
339 |
// cartDetailsObj.cartItems[$(this).data('id')].unitprice = parseInt($(this).attr('data-price'));
|
| 302 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
340 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 303 |
}else{
|
341 |
}else{
|
| 304 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
342 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
| 305 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
343 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 306 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
344 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 307 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
345 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 308 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
346 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
| - |
|
347 |
|
| - |
|
348 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-minquantity',$(this).data('minquantity'));
|
| - |
|
349 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-bulkpricing',$(this).attr('data-bulkpricing'));
|
| - |
|
350 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-quantitystep',$(this).data('quantitystep'));
|
| - |
|
351 |
|
| 309 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
352 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| 310 |
}
|
353 |
}
|
| 311 |
}else{
|
354 |
}else{
|
| 312 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
355 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
| 313 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
356 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 314 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
357 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 315 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
358 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 316 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
359 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
| - |
|
360 |
|
| - |
|
361 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-minquantity',$(this).data('minquantity'));
|
| - |
|
362 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-bulkpricing',$(this).attr('data-bulkpricing'));
|
| - |
|
363 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-quantitystep',$(this).data('quantitystep'));
|
| - |
|
364 |
|
| 317 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
365 |
$(".accsproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| 318 |
}
|
366 |
}
|
| 319 |
|
367 |
|
| 320 |
});
|
368 |
});
|
| 321 |
|
369 |
|