Subversion Repositories SmartDukaan

Rev

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

Rev 18261 Rev 18290
Line 166... Line 166...
166
							$(variantslink).data('variants',variants).data('minprice',minprice);
166
							$(variantslink).data('variants',variants).data('minprice',minprice);
167
						}
167
						}
168
					}
168
					}
169
					if(inStock){
169
					if(inStock){
170
						$(that).html(minprice).siblings('.cashbackamount').html(getcashbackstring(response.products[minpriceindex].cash_back_type,response.products[minpriceindex].cash_back)).parent().addClass('viewproduct');
170
						$(that).html(minprice).siblings('.cashbackamount').html(getcashbackstring(response.products[minpriceindex].cash_back_type,response.products[minpriceindex].cash_back)).parent().addClass('viewproduct');
-
 
171
						
-
 
172
						if($(that).parent().data('storename') == "Saholic")
-
 
173
						{
-
 
174
							var url = minpriceurl;
-
 
175
							var value = url.substring(url.lastIndexOf('-') + 1);
-
 
176
							$(that).parent().attr('data-identifier', value);
-
 
177
						}
-
 
178
 
171
						$('#name-'+$(that).data('id')).html(response.products[minpriceindex]['source_product_name']);
179
						$('#name-'+$(that).data('id')).html(response.products[minpriceindex]['source_product_name']);
172
						if(response.products[minpriceindex]['coupon'] && response.products[minpriceindex]['coupon'].length>0){
180
						if(response.products[minpriceindex]['coupon'] && response.products[minpriceindex]['coupon'].length>0){
173
							$('#couponcode-'+$(that).data('id')).show().find('span.red',0).html(getCouponText(response.products[minpriceindex]['coupon']));
181
							$('#couponcode-'+$(that).data('id')).show().find('span.red',0).html(getCouponText(response.products[minpriceindex]['coupon']));
174
						}			
182
						}			
175
						if(!response.products[minpriceindex]['codAvailable']){
183
						if(!response.products[minpriceindex]['codAvailable']){
Line 183... Line 191...
183
						}
191
						}
184
						$('#sku-'+$(that).data('id')).data('id',response.products[minpriceindex]['_id']).data('source',response.products[minpriceindex]['source_id']).data('price',response.products[minpriceindex]['available_price']).data('url',response.products[minpriceindex]['marketPlaceUrl']).removeClass('hidden');
192
						$('#sku-'+$(that).data('id')).data('id',response.products[minpriceindex]['_id']).data('source',response.products[minpriceindex]['source_id']).data('price',response.products[minpriceindex]['available_price']).data('url',response.products[minpriceindex]['marketPlaceUrl']).removeClass('hidden');
185
						if(globalminprice != 9999999) {
193
						if(globalminprice != 9999999) {
186
							$('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback).siblings('.productoffer').html(globalminoffer);
194
							$('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback).siblings('.productoffer').html(globalminoffer);
187
							$('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
195
							$('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
-
 
196
 
-
 
197
							var url =$('#beststorelink').data('url');
-
 
198
							var value = url.substring(url.lastIndexOf('-') + 1);
-
 
199
							$('#beststorelink').attr('data-identifier', value);
188
							$('#bestpricecontainer').removeClass('hidden');
200
							$('#bestpricecontainer').removeClass('hidden');
189
						} 
201
						} 
190
					} else{
202
					} else{
191
						ga('send', 'event', 'liveprice', 'outofstock', $('#bestpriceproductname').html());
203
						ga('send', 'event', 'liveprice', 'outofstock', $('#bestpriceproductname').html());
192
						var properties = {};
204
						var properties = {};
Line 342... Line 354...
342
		var url = $(this).data('url');
354
		var url = $(this).data('url');
343
		
355
		
344
		window.location = url;
356
		window.location = url;
345
	});
357
	});
346
	
358
	
347
	$(document).on('click','.viewproduct',function(e){		
359
	$(document).on('click','.viewproduct',function(e){
-
 
360
 
-
 
361
		var proid = $(this).data("proid");
-
 
362
		var identifier = $(this).data("identifier");
-
 
363
		
348
		if(typeof livePriceCalls != undefined) {
364
		if(typeof livePriceCalls != undefined) {
349
	    	for(var i in livePriceCalls){
365
	    	for(var i in livePriceCalls){
350
	    		livePriceCalls[i].abort();
366
	    		livePriceCalls[i].abort();
351
	    	}
367
	    	}
352
	    }
368
	    }
Line 414... Line 430...
414
                            $('#customMessageModal').modal('show');                         
430
                            $('#customMessageModal').modal('show');                         
415
                            setTimeout(function(){ document.location = response.url;}, 1000*3);         
431
                            setTimeout(function(){ document.location = response.url;}, 1000*3);         
416
                        } else{
432
                        } else{
417
                            document.location = response.url;   
433
                            document.location = response.url;   
418
                        }
434
                        }
-
 
435
                    } else if (store == 4) {
-
 
436
                    	var urll = apihost+"categories/saholicdeal/"+proid;
-
 
437
                    	$.ajax({
-
 
438
                            method: "GET",
-
 
439
                            url:  urll,
-
 
440
                        },'json')
-
 
441
                        .done(function(msg){
-
 
442
              
-
 
443
                        	localStorage.removeItem("productdetail");
-
 
444
                			localStorage.setItem("productdetail",msg);
419
                    } else {
445
                        });
-
 
446
                    	
-
 
447
                    	document.location = apihost+"categories/dealdetail/"+identifier;
420
                        response.url = '/r.html?'+Base64.encode(response.url);
448
//                        response.url = '/r.html?'+Base64.encode(response.url);
-
 
449
 
421
                        document.location = response.url;
450
//                        document.location = response.url;
-
 
451
                    } 
-
 
452
					
-
 
453
					else{
-
 
454
						response.url = '/r.html?'+Base64.encode(response.url);
-
 
455
 
422
                    }                                       
456
                      document.location = response.url;
-
 
457
					}
423
                }
458
                }
424
            },
459
            },
425
            error: function() {
460
            error: function() {
426
                document.location = url;
461
                document.location = url;
427
            }
462
            }