| Line 13... |
Line 13... |
| 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 = $(".number-spinner button[data-id='"+key+"']").data('price');
|
17 |
var newUnitPrice = $(".number-spinner button[data-id='"+key+"']").data('price');
|
| - |
|
18 |
var bulkpricing = $(".number-spinner button[data-id='"+key+"']").data('bulkpricing');
|
| - |
|
19 |
if (bulkpricing != undefined && bulkpricing.length != 0){
|
| - |
|
20 |
for(var i=0;i<bulkpricing.length;i++)
|
| - |
|
21 |
{
|
| - |
|
22 |
if(val.quantity<bulkpricing[i]['quantity']){
|
| - |
|
23 |
break;
|
| - |
|
24 |
}
|
| - |
|
25 |
else{
|
| - |
|
26 |
newUnitPrice = bulkpricing[i]['price'];
|
| - |
|
27 |
}
|
| - |
|
28 |
}
|
| - |
|
29 |
}
|
| 18 |
if(newUnitPrice!=undefined){
|
30 |
if(newUnitPrice!=undefined){
|
| 19 |
$(".number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
|
31 |
$(".number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
|
| 20 |
if(parseInt(newUnitPrice)!=parseInt(val.unitprice)){
|
32 |
if(parseInt(newUnitPrice)!=parseInt(val.unitprice)){
|
| 21 |
totalCartValue = totalCartValue - (parseInt(val.unitprice)*parseInt(val.quantity)) + (parseInt(newUnitPrice)*parseInt(val.quantity));
|
33 |
totalCartValue = totalCartValue - (parseInt(val.unitprice)*parseInt(val.quantity)) + (parseInt(newUnitPrice)*parseInt(val.quantity));
|
| 22 |
priceChangeMap[key] = newUnitPrice;
|
34 |
priceChangeMap[key] = newUnitPrice;
|
| Line 79... |
Line 91... |
| 79 |
totalCartValue = cartDetailsObj.totalCartValue;
|
91 |
totalCartValue = cartDetailsObj.totalCartValue;
|
| 80 |
cartItems = cartDetailsObj.cartItems;
|
92 |
cartItems = cartDetailsObj.cartItems;
|
| 81 |
}
|
93 |
}
|
| 82 |
var inc = 0;
|
94 |
var inc = 0;
|
| 83 |
var dec = 0;
|
95 |
var dec = 0;
|
| - |
|
96 |
// var sku = btn.data('id');
|
| 84 |
var sku = btn.attr('data-id');
|
97 |
var sku = btn.attr('data-id');
|
| 85 |
var unitPrice = btn.data('price');
|
98 |
var unitPrice = btn.data('price');
|
| 86 |
var prodname = btn.data('name');
|
99 |
var prodname = btn.data('name');
|
| 87 |
var brandname = btn.data('brand');
|
100 |
var brandname = btn.data('brand');
|
| 88 |
var catalogItemId = btn.data('identifier');
|
101 |
var catalogItemId = btn.data('identifier');
|
| - |
|
102 |
var minBuyQuantity = btn.data('minquantity');
|
| - |
|
103 |
if(minBuyQuantity == "" || minBuyQuantity == undefined){
|
| - |
|
104 |
minBuyQuantity =1;
|
| - |
|
105 |
}
|
| - |
|
106 |
var quantityStep = btn.data('quantitystep');
|
| - |
|
107 |
if(quantityStep == "" || quantityStep == undefined){
|
| - |
|
108 |
quantityStep =1;
|
| - |
|
109 |
}
|
| - |
|
110 |
var bulkpricing = btn.data('bulkpricing');
|
| - |
|
111 |
|
| 89 |
if (btn.attr('data-dir') == 'up') {
|
112 |
if (btn.attr('data-dir') == 'up') {
|
| 90 |
if ( input.attr('max') == undefined || parseInt(input.val()) < parseInt(input.attr('max')) ) {
|
113 |
if ( input.attr('max') == undefined || parseInt(input.val()) < parseInt(input.attr('max')) ) {
|
| 91 |
if(parseInt(input.val())<5){
|
114 |
// if(parseInt(input.val())<5){
|
| 92 |
inc = 1;
|
115 |
// inc = 1;
|
| - |
|
116 |
// newVal = parseInt(oldValue) + inc;
|
| - |
|
117 |
// }else{
|
| - |
|
118 |
// inc = 5-(parseInt(input.val())%5);
|
| - |
|
119 |
// newVal = parseInt(oldValue) + inc;
|
| - |
|
120 |
// if(newVal>parseInt(input.attr('max'))){
|
| - |
|
121 |
// inc = parseInt(input.attr('max')) - parseInt(oldValue);
|
| - |
|
122 |
// newVal = parseInt(oldValue) + inc;
|
| - |
|
123 |
// }
|
| - |
|
124 |
// }
|
| - |
|
125 |
if((parseInt(input.val())== 0 || parseInt(input.val())< minBuyQuantity) && (parseInt(input.attr('max')) >= minBuyQuantity)){
|
| - |
|
126 |
inc = minBuyQuantity - parseInt(input.val());
|
| 93 |
newVal = parseInt(oldValue) + inc;
|
127 |
newVal = parseInt(oldValue) + inc;
|
| - |
|
128 |
}
|
| 94 |
}else{
|
129 |
else{
|
| 95 |
inc = 5-(parseInt(input.val())%5);
|
130 |
inc = quantityStep;
|
| 96 |
newVal = parseInt(oldValue) + inc;
|
131 |
newVal = parseInt(oldValue) + inc;
|
| 97 |
if(newVal>parseInt(input.attr('max'))){
|
132 |
if(newVal>parseInt(input.attr('max'))){
|
| 98 |
inc = parseInt(input.attr('max')) - parseInt(oldValue);
|
133 |
inc = parseInt(input.attr('max')) - parseInt(oldValue);
|
| 99 |
newVal = parseInt(oldValue) + inc;
|
134 |
newVal = parseInt(oldValue) + inc;
|
| 100 |
}
|
135 |
}
|
| Line 109... |
Line 144... |
| 109 |
input.attr('style', 'border: 1px solid #CCCCCC');
|
144 |
input.attr('style', 'border: 1px solid #CCCCCC');
|
| 110 |
}
|
145 |
}
|
| 111 |
totalCartQuantity = totalCartQuantity + inc;
|
146 |
totalCartQuantity = totalCartQuantity + inc;
|
| 112 |
} else {
|
147 |
} else {
|
| 113 |
if ( input.attr('min') == undefined || parseInt(input.val()) > parseInt(input.attr('min')) ) {
|
148 |
if ( input.attr('min') == undefined || parseInt(input.val()) > parseInt(input.attr('min')) ) {
|
| 114 |
dec = 1;
|
149 |
// dec = 1;
|
| - |
|
150 |
dec = quantityStep;
|
| 115 |
newVal = parseInt(oldValue) - dec;
|
151 |
newVal = parseInt(oldValue) - dec;
|
| - |
|
152 |
var minBuyQtyDiff = parseInt(oldValue) - minBuyQuantity;
|
| - |
|
153 |
if(minBuyQtyDiff ==0){
|
| - |
|
154 |
dec = minBuyQuantity;
|
| - |
|
155 |
newVal = parseInt(oldValue) - dec;
|
| - |
|
156 |
}else if(dec>minBuyQtyDiff){
|
| - |
|
157 |
dec = minBuyQtyDiff;
|
| - |
|
158 |
newVal = parseInt(oldValue) - dec;
|
| - |
|
159 |
}
|
| 116 |
}else{
|
160 |
}else{
|
| 117 |
btn.prop("disabled", true);
|
161 |
btn.prop("disabled", true);
|
| 118 |
}
|
162 |
}
|
| 119 |
if(newVal==parseInt(input.attr('min'))){
|
163 |
if(newVal==parseInt(input.attr('min'))){
|
| 120 |
input.attr('style', 'border: 2px solid #5bc0de');
|
164 |
input.attr('style', 'border: 2px solid #5bc0de');
|
| Line 123... |
Line 167... |
| 123 |
}
|
167 |
}
|
| 124 |
totalCartQuantity = totalCartQuantity - dec;
|
168 |
totalCartQuantity = totalCartQuantity - dec;
|
| 125 |
}
|
169 |
}
|
| 126 |
|
170 |
|
| 127 |
btn.closest('.number-spinner').find('input').val(newVal);
|
171 |
btn.closest('.number-spinner').find('input').val(newVal);
|
| - |
|
172 |
|
| - |
|
173 |
if (bulkpricing != undefined && bulkpricing.length != 0){
|
| - |
|
174 |
bulkpricing = bulkpricing.sort(function(a, b){
|
| - |
|
175 |
return a.quantity - b.quantity;
|
| - |
|
176 |
});
|
| - |
|
177 |
for(var i=0;i<bulkpricing.length;i++)
|
| - |
|
178 |
{
|
| - |
|
179 |
if(newVal<bulkpricing[i]['quantity']){
|
| - |
|
180 |
break;
|
| - |
|
181 |
}
|
| - |
|
182 |
else{
|
| - |
|
183 |
|
| - |
|
184 |
unitPrice = bulkpricing[i]['price'];
|
| - |
|
185 |
}
|
| - |
|
186 |
}
|
| - |
|
187 |
}
|
| - |
|
188 |
|
| 128 |
if(cartDetailsObj==undefined){
|
189 |
if(cartDetailsObj==undefined){
|
| 129 |
jsonObjToBeStored['totalCartQuantity'] = totalCartQuantity;
|
190 |
jsonObjToBeStored['totalCartQuantity'] = totalCartQuantity;
|
| 130 |
totalCartValue = totalCartValue + (unitPrice * newVal);
|
191 |
totalCartValue = totalCartValue + (unitPrice * newVal);
|
| 131 |
jsonObjToBeStored['totalCartValue'] = totalCartValue;
|
192 |
jsonObjToBeStored['totalCartValue'] = totalCartValue;
|
| 132 |
var itemDetail = {};
|
193 |
var itemDetail = {};
|
| Line 197... |
Line 258... |
| 197 |
});
|
258 |
});
|
| 198 |
|
259 |
|
| 199 |
$(document).on('click','.see_more_colors',function(){
|
260 |
$(document).on('click','.see_more_colors',function(){
|
| 200 |
var id = $(".number-spinner button").data('id');
|
261 |
var id = $(".number-spinner button").data('id');
|
| 201 |
if($('.morecoloroptions_'+$(this).data('id')+' .button-checkbox button').hasClass('active'))
|
262 |
if($('.morecoloroptions_'+$(this).data('id')+' .button-checkbox button').hasClass('active'))
|
| 202 |
{}
|
263 |
{}
|
| 203 |
else{
|
264 |
else{
|
| 204 |
$(".morecoloroptions_"+$(this).data('id')+" button:first-child" ).addClass("active");
|
265 |
$(".morecoloroptions_"+$(this).data('id')+" button:first-child" ).addClass("active");
|
| 205 |
}
|
266 |
}
|
| 206 |
|
- |
|
| 207 |
$('.morecoloroptions_'+$(this).data('id')).toggleClass('hidden');
|
267 |
$('.morecoloroptions_'+$(this).data('id')).toggleClass('hidden');
|
| 208 |
});
|
268 |
});
|
| 209 |
|
269 |
|
| 210 |
$(document).on('click','.button-checkbox > .btn',function(){
|
270 |
$(document).on('click','.button-checkbox > .btn',function(){
|
| 211 |
$(this).addClass('active').siblings().removeClass('active');
|
271 |
$(this).addClass('active').siblings().removeClass('active');
|
| Line 218... |
Line 278... |
| 218 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
278 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
| 219 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
279 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 220 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
280 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 221 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
281 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 222 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val(item.quantity);
|
282 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val(item.quantity);
|
| 223 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).data('price')));
|
283 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| 224 |
cartDetailsObj.cartItems[$(this).data('id')].unitprice = parseInt($(this).data('price'));
|
284 |
cartDetailsObj.cartItems[$(this).data('id')].unitprice = parseInt($(this).attr('data-price'));
|
| 225 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
285 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 226 |
}else{
|
286 |
}else{
|
| 227 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
287 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
| 228 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
288 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 229 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
289 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 230 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
290 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 231 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
291 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
| 232 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).data('price')));
|
292 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| 233 |
}
|
293 |
}
|
| 234 |
}else{
|
294 |
}else{
|
| 235 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
295 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('style', 'border: 0');
|
| 236 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
296 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-id',$(this).data('id'));
|
| 237 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
297 |
$(".number-spinner button[data-did='"+$(this).data('did')+"']").attr('data-price',parseInt($(this).data('price')));
|
| 238 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
298 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").attr('max',parseInt($(this).data('max')));
|
| 239 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
299 |
$(".number-spinner input[data-did='"+$(this).data('did')+"']").val('0');
|
| 240 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).data('price')));
|
300 |
$(".viewproduct span[data-did='"+$(this).data('did')+"']").text(parseInt($(this).attr('data-price')));
|
| 241 |
}
|
301 |
}
|
| 242 |
|
302 |
|
| 243 |
});
|
303 |
});
|
| 244 |
|
304 |
|
| 245 |
$(document).on('click','#bottomNav',function(){
|
305 |
$(document).on('click','#bottomNav',function(){
|
| Line 538... |
Line 598... |
| 538 |
if ($button.find('.state-icon').length == 0) {
|
598 |
if ($button.find('.state-icon').length == 0) {
|
| 539 |
$button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i>');
|
599 |
$button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i>');
|
| 540 |
}
|
600 |
}
|
| 541 |
}
|
601 |
}
|
| 542 |
init();
|
602 |
init();
|
| 543 |
});*/
|
- |
|
| 544 |
|
603 |
});*/
|
| - |
|
604 |
|
| - |
|
605 |
|
| - |
|
606 |
|