Subversion Repositories SmartDukaan

Rev

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

Rev 15901 Rev 15920
Line 40... Line 40...
40
	    return array.sort(function(a, b) {
40
	    return array.sort(function(a, b) {
41
	        var x = a[key]; var y = b[key];
41
	        var x = a[key]; var y = b[key];
42
	        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
42
	        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
43
	    });
43
	    });
44
	};
44
	};
-
 
45
	function showCoupon(coupon,source_id) {
-
 
46
		$('#couponcode-'+source_id).html(coupon);
-
 
47
	}
-
 
48
	function showShopcluesPopup(url){
-
 
49
		$('#shopcluesUrl').prop('href',url);
-
 
50
		$('#shopcluesModal').modal('show');
-
 
51
		return;
-
 
52
	}
45
	function fetchLivePrice(obj){		
53
	function fetchLivePrice(obj){		
46
		ga('send', 'event', 'liveprice', 'fetch',$('#bestpriceproductname').html());
54
		ga('send', 'event', 'liveprice', 'fetch',$('#bestpriceproductname').html());
47
		var properties = {};
55
		var properties = {};
48
		properties.bundle_id = String($(obj).data('bundle_id'));
56
		properties.bundle_id = String($(obj).data('bundle_id'));
49
		properties.product_name = String($('#bestpriceproductname').html());
57
		properties.product_name = String($('#bestpriceproductname').html());
Line 72... Line 80...
72
						var variants = [];
80
						var variants = [];
73
						// var i = 0;
81
						// var i = 0;
74
						for(var i in response.products){	
82
						for(var i in response.products){	
75
							if(response.products[i].in_stock == 1){
83
							if(response.products[i].in_stock == 1){
76
								inStock = true;
84
								inStock = true;
-
 
85
								if(response.products[i].coupon){
-
 
86
									showCoupon(response.products[i].coupon,response.products[i].source_id);
-
 
87
								}
77
								if(response.products[i].available_price && response.products[i].available_price < globalminprice) {
88
								if(response.products[i].available_price && response.products[i].available_price < globalminprice) {
78
									globalminprice = Math.round(response.products[i].available_price);
89
									globalminprice = Math.round(response.products[i].available_price);
79
									globalminsku = response.products[i]._id;
90
									globalminsku = response.products[i]._id;
80
									var globalminsource = response.products[i].source_id;
91
									var globalminsource = response.products[i].source_id;
81
									var globalminurl = response.products[i].marketPlaceUrl;
92
									var globalminurl = response.products[i].marketPlaceUrl;
Line 243... Line 254...
243
				format: "json"
254
				format: "json"
244
			},
255
			},
245
			// Work with the response
256
			// Work with the response
246
			success: function( response ) {
257
			success: function( response ) {
247
				if(response.success && response.type=='redirect'){
258
				if(response.success && response.type=='redirect'){
248
					if(store == 1 ) {
259
					if(store == 5) {
-
 
260
						//check if shopclues is active or not
-
 
261
						active = getCookie('shopcluesActive',1);
-
 
262
						if(active && active == 1){
-
 
263
							document.location = response.url;	
-
 
264
							pma.send('apk','shopclues','active',me,null);
-
 
265
						}else{
-
 
266
							pma.send('apk','shopclues','inactive',me,null);
-
 
267
							$('#loadingModal').modal('hide');
-
 
268
							showShopcluesPopup(response.url);
-
 
269
							// return;
-
 
270
						}
-
 
271
					} else if(store == 1 ) {
249
						url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
272
						url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
250
						document.location = url;
273
						document.location = url;
251
					} else if (store == 3 || store == 2) {
274
					} else if (store == 3 || store == 2) {
252
						if (store == 2){
275
						if (store == 2){
253
							response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
276
							response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);