Subversion Repositories SmartDukaan

Rev

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

Rev 18527 Rev 18543
Line 15... Line 15...
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');
18
			var bulkpricing = $(".number-spinner button[data-id='"+key+"']").data('bulkpricing');
19
			if (bulkpricing != undefined && bulkpricing.length > 1){
19
			if (bulkpricing != undefined && bulkpricing.length > 1){
20
				bulkpricing = bulkpricing.sort(function(a, b){
20
//				bulkpricing = bulkpricing.sort(function(a, b){
21
					return a.quantity - b.quantity;
21
//					return a.quantity - b.quantity;
22
	            });
22
//	            });
-
 
23
				
-
 
24
 
23
		    	for(var i=0;i<bulkpricing.length;i++)
25
		    	for(var i=0;i<bulkpricing.length;i++)
24
		    		{
26
		    		{
25
		    			if(val.quantity<bulkpricing[i]['quantity']){
27
		    			if(val.quantity<bulkpricing[i]['quantity']){
-
 
28
//		    				$(".number-spinner button[data-id='"+key+"']").parent().parent().parent().parent().find('.select'+key+'a'+bulkpricing[i-1]['quantity']).addClass('setback');
26
		    				break;
29
		    				break;
27
		    			}
30
		    			}
28
		    			else{
31
		    			else{
29
		    				newUnitPrice = bulkpricing[i]['price'];
32
		    				newUnitPrice = bulkpricing[i]['price'];
-
 
33
		    				
-
 
34
		    				$(".number-spinner button[data-id='"+key+"']").parent().parent().parent().parent().find('.setback').removeClass('setback');
-
 
35
		    				$(".number-spinner button[data-id='"+key+"']").parent().parent().parent().parent().find('.select'+key+'a'+bulkpricing[i]['quantity']).addClass('setback');
-
 
36
 
30
		    			}
37
		    			}
31
		    		}
38
		    		}
32
		    }
39
		    }
33
			if(newUnitPrice!=undefined){
40
			if(newUnitPrice!=undefined){
34
				$(".number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
41
				$(".number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
Line 175... Line 182...
175
	
182
	
176
	if (bulkpricing != undefined && bulkpricing.length > 1){
183
	if (bulkpricing != undefined && bulkpricing.length > 1){
177
		bulkpricing = bulkpricing.sort(function(a, b){
184
		bulkpricing = bulkpricing.sort(function(a, b){
178
		    return a.quantity - b.quantity;
185
		    return a.quantity - b.quantity;
179
		});
186
		});
-
 
187
		
-
 
188
		if(newVal == 0){
-
 
189
			$(this).parent().parent().parent().parent().find('.setback').removeClass('setback');
-
 
190
//			$(this).parent().parent().parent().parent().find('.select'+sku+'a'+bulkpricing[0]['quantity']).addClass('setback');
-
 
191
		}
-
 
192
		
180
    	for(var i=0;i<bulkpricing.length;i++)
193
    	for(var i=0;i<bulkpricing.length;i++)
181
    		{
194
    		{
182
    			if(newVal<bulkpricing[i]['quantity']){
195
    			if(newVal<bulkpricing[i]['quantity']){
183
    				break;
196
    				break;
184
    			}
197
    			}
185
    			else{
198
    			else{
186
    				
-
 
-
 
199
    				$(this).parent().parent().parent().parent().find('.setback').removeClass('setback');
-
 
200
    				$(this).parent().parent().parent().parent().find('.select'+sku+'a'+bulkpricing[i]['quantity']).addClass('setback');
187
    				unitPrice = bulkpricing[i]['price'];
201
    				unitPrice = bulkpricing[i]['price'];
188
    			}
202
    			}
189
    		}
203
    		}
190
    }
204
    }
191
	
205