Subversion Repositories SmartDukaan

Rev

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

Rev 17881 Rev 17905
Line 54... Line 54...
54
	}else{
54
	}else{
55
		$('div.cartdetailscard').find('div, input, textarea, button, select').each(function () {
55
		$('div.cartdetailscard').find('div, input, textarea, button, select').each(function () {
56
		    $(this).prop('disabled', true);
56
		    $(this).prop('disabled', true);
57
		});
57
		});
58
	}
58
	}
-
 
59
	if(!$('div.cartitemstotal').hasClass('hidden')){
-
 
60
		$('div.scroll').attr('style', 'margin-bottom: 155px');
-
 
61
	}else{
-
 
62
		$('div.scroll').attr('style', 'margin-bottom: 100px');
-
 
63
	}
59
}
64
}
60
 
65
 
61
$(function(){
66
$(function(){
62
	loadCartPageDetails();
67
	loadCartPageDetails();
63
});
68
});
Line 103... Line 108...
103
			}
108
			}
104
		}else{
109
		}else{
105
			newVal = parseInt(oldValue);
110
			newVal = parseInt(oldValue);
106
			btn.prop("disabled", true);
111
			btn.prop("disabled", true);
107
		}
112
		}
-
 
113
		if(newVal==parseInt(input.attr('max'))){
-
 
114
			input.attr('style', 'border: 2px solid #ff0000');
-
 
115
		}else{
-
 
116
			input.attr('style', 'border: 1px solid #CCCCCC');
-
 
117
		}
108
		totalCartQuantity = totalCartQuantity + inc;
118
		totalCartQuantity = totalCartQuantity + inc;
109
	} else {
119
	} else {
110
		if ( input.attr('min') == undefined || parseInt(input.val()) > parseInt(input.attr('min')) ) {
120
		if ( input.attr('min') == undefined || parseInt(input.val()) > parseInt(input.attr('min')) ) {
111
		    dec = 1;
121
		    dec = 1;
112
			newVal = parseInt(oldValue) - dec;
122
			newVal = parseInt(oldValue) - dec;
113
		}else{
123
		}else{
114
			btn.prop("disabled", true);
124
			btn.prop("disabled", true);
115
		}
125
		}
-
 
126
		if(newVal==parseInt(input.attr('min'))){
-
 
127
			input.attr('style', 'border: 2px solid #5bc0de');
-
 
128
		}else{
-
 
129
			input.attr('style', 'border: 1px solid #CCCCCC');
-
 
130
		}
116
		totalCartQuantity = totalCartQuantity - dec;
131
		totalCartQuantity = totalCartQuantity - dec;
117
	}
132
	}
118
    
-
 
-
 
133
    $("span.lineitemqty[data-id='"+sku+"']").text(newVal);
119
	btn.closest('.number-spinner').find('input').val(newVal);
134
	btn.closest('.number-spinner').find('input').val(newVal);
120
	if(cartDetailsObj==undefined){
135
	if(cartDetailsObj==undefined){
121
		jsonObjToBeStored['totalCartQuantity'] = totalCartQuantity;
136
		jsonObjToBeStored['totalCartQuantity'] = totalCartQuantity;
122
		totalCartValue = totalCartValue + (unitPrice * newVal);
137
		totalCartValue = totalCartValue + (unitPrice * newVal);
123
		jsonObjToBeStored['totalCartValue'] = totalCartValue;
138
		jsonObjToBeStored['totalCartValue'] = totalCartValue;
Line 173... Line 188...
173
		cartDetailsObj.totalCartValue = totalCartValue;
188
		cartDetailsObj.totalCartValue = totalCartValue;
174
		cartDetailsObj.cartItems = cartItems;
189
		cartDetailsObj.cartItems = cartItems;
175
		cartDetailsObj.totalSkus = totalSkus;
190
		cartDetailsObj.totalSkus = totalSkus;
176
		if(parseInt(totalCartValue)>1000){
191
		if(parseInt(totalCartValue)>1000){
177
			shippingCharges = 0;
192
			shippingCharges = 0;
178
		}else if(parseInt(totalCartValue)>=500 && parseInt(totalCartValue)<500){
193
		}else if(parseInt(totalCartValue)>=500 && parseInt(totalCartValue)<1000){
179
			shippingCharges = 50;
194
			shippingCharges = 50;
180
		}else{
195
		}else if(parseInt(totalCartValue)>0 && parseInt(totalCartValue)<500){
181
			shippingCharges = 100;
196
			shippingCharges = 100;
-
 
197
		}else{
-
 
198
			shippingCharges = 0;
182
		}
199
		}
183
		cartDetailsObj.shippingCharges = shippingCharges;
200
		cartDetailsObj.shippingCharges = shippingCharges;
184
		localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
201
		localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
185
	}
202
	}
186
	$('div.cartitemstotal span.itemstotal').text('₹ '+numberWithCommas(totalCartValue));
203
	$('div.cartitemstotal span.itemstotal').text('₹ '+numberWithCommas(totalCartValue));
Line 202... Line 219...
202
	if(payable>0){
219
	if(payable>0){
203
		$('button.checkoutbtn').prop( "disabled", false );
220
		$('button.checkoutbtn').prop( "disabled", false );
204
	}else{
221
	}else{
205
		$('button.checkoutbtn').prop( "disabled", true );
222
		$('button.checkoutbtn').prop( "disabled", true );
206
	}
223
	}
-
 
224
	if(!$('div.cartitemstotal').hasClass('hidden')){
-
 
225
		$('div.scroll').attr('style', 'margin-bottom: 155px');
-
 
226
	}else{
-
 
227
		$('div.scroll').attr('style', 'margin-bottom: 100px');
-
 
228
	}
207
});
229
});
208
 
230
 
209
function numberWithCommas(x) {
231
function numberWithCommas(x) {
210
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
232
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
211
}
233
}