| Line 74... |
Line 74... |
| 74 |
};
|
74 |
};
|
| 75 |
function getCouponText(coupon){
|
75 |
function getCouponText(coupon){
|
| 76 |
return "<span class='red'>"+coupon+"</span>";
|
76 |
return "<span class='red'>"+coupon+"</span>";
|
| 77 |
};
|
77 |
};
|
| 78 |
function getGrossPriceText(gross_price,available_price){
|
78 |
function getGrossPriceText(gross_price,available_price){
|
| 79 |
return "("+gross_price+" - Paytm cashback "+(gross_price-available_price)+")"
|
79 |
return "Paytm cashback - "+(gross_price-available_price)+"<br>Net Price - <span class='red'>"+available_price+"</span>"
|
| 80 |
}
|
80 |
}
|
| 81 |
function fetchLivePrice(obj){
|
81 |
function fetchLivePrice(obj){
|
| 82 |
ga('send', 'event', 'liveprice', 'fetch',$('#bestpriceproductname').html());
|
82 |
ga('send', 'event', 'liveprice', 'fetch',$('#bestpriceproductname').html());
|
| 83 |
var properties = {};
|
83 |
var properties = {};
|
| 84 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
84 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
| 85 |
properties.product_name = String($('#bestpriceproductname').html());
|
85 |
properties.product_name = String($('#bestpriceproductname').html());
|
| 86 |
pma.send('products','livesprice','fetch',me,properties);
|
86 |
pma.send('products','livesprice','fetch',me,properties);
|
| 87 |
var that = obj;
|
87 |
var that = obj;
|
| 88 |
var inStock = false;
|
88 |
var inStock = false;
|
| - |
|
89 |
var priceToCompare = 0;
|
| 89 |
var req = $.ajax({
|
90 |
var req = $.ajax({
|
| 90 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
91 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
| 91 |
// Tell jQuery we're expecting JSONP
|
92 |
// Tell jQuery we're expecting JSONP
|
| 92 |
dataType: "json",
|
93 |
dataType: "json",
|
| 93 |
// Tell YQL what we want and that we want JSON
|
94 |
// Tell YQL what we want and that we want JSON
|
| Line 98... |
Line 99... |
| 98 |
if(response.success){
|
99 |
if(response.success){
|
| 99 |
var i = 0;
|
100 |
var i = 0;
|
| 100 |
var minpriceindex = 0;
|
101 |
var minpriceindex = 0;
|
| 101 |
if(response.products[i].in_stock == 1) {
|
102 |
if(response.products[i].in_stock == 1) {
|
| 102 |
inStock = true;
|
103 |
inStock = true;
|
| 103 |
var minprice = Math.round(response.products[i]['available_price']);
|
104 |
var minprice = 9999999;//Math.round(response.products[i]['available_price']);
|
| 104 |
var minpriceurl = response.products[i]['marketPlaceUrl'];
|
105 |
var minpriceurl = response.products[i]['marketPlaceUrl'];
|
| 105 |
}
|
106 |
}
|
| 106 |
if(response.products.length>0){
|
107 |
if(response.products.length>0){
|
| 107 |
//More than one products in store
|
108 |
//More than one products in store
|
| 108 |
var variants = [];
|
109 |
var variants = [];
|
| 109 |
var j = 0;
|
110 |
var j = 0;
|
| 110 |
for(var i in response.products){
|
111 |
for(var i in response.products){
|
| 111 |
if(response.products[i].in_stock == 1){
|
112 |
if(response.products[i].in_stock == 1){
|
| - |
|
113 |
if(response.products[i].gross_price && response.products[i].gross_price > response.products[i].available_price) {
|
| - |
|
114 |
priceToCompare = response.products[i].gross_price;
|
| - |
|
115 |
}else{
|
| - |
|
116 |
priceToCompare = response.products[i].available_price;
|
| - |
|
117 |
}
|
| 112 |
inStock = true;
|
118 |
inStock = true;
|
| 113 |
if(response.products[i].available_price && response.products[i].available_price < globalminprice) {
|
119 |
if(priceToCompare && priceToCompare < globalminprice) {
|
| 114 |
globalminprice = Math.round(response.products[i].available_price);
|
120 |
globalminprice = Math.round(priceToCompare);
|
| 115 |
globalminsku = response.products[i]._id;
|
121 |
globalminsku = response.products[i]._id;
|
| 116 |
var globalminsource = response.products[i].source_id;
|
122 |
var globalminsource = response.products[i].source_id;
|
| 117 |
var globalminurl = response.products[i].marketPlaceUrl;
|
123 |
var globalminurl = response.products[i].marketPlaceUrl;
|
| 118 |
var globalminoffer = response.products[i].offer;
|
124 |
var globalminoffer = response.products[i].offer;
|
| 119 |
var globalmincashback = getcashbackstring(response.products[i].cash_back_type,response.products[i].cash_back);
|
125 |
var globalmincashback = getcashbackstring(response.products[i].cash_back_type,response.products[i].cash_back);
|
| 120 |
}
|
126 |
}
|
| 121 |
if(typeof minprice == 'undefined' || response.products[i].available_price < minprice) {
|
127 |
if(typeof minprice == 'undefined' || priceToCompare < minprice) {
|
| 122 |
minprice = Math.round(response.products[i].available_price);
|
128 |
minprice = Math.round(priceToCompare);
|
| 123 |
minpriceindex = j;
|
129 |
minpriceindex = j;
|
| 124 |
}
|
130 |
}
|
| 125 |
if(response.products[i].tagline && response.products[i].tagline.length>0 && $('#productoneliner').html().length==0) {
|
131 |
if(response.products[i].tagline && response.products[i].tagline.length>0 && $('#productoneliner').html().length==0) {
|
| 126 |
$('#productoneliner').html(response.products[i].tagline).removeClass('hidden').show();
|
132 |
$('#productoneliner').html(response.products[i].tagline).removeClass('hidden').show();
|
| 127 |
}
|
133 |
}
|
| Line 218... |
Line 224... |
| 218 |
$('.storeproductinfo').empty();
|
224 |
$('.storeproductinfo').empty();
|
| 219 |
var variants = $(this).data('variants');
|
225 |
var variants = $(this).data('variants');
|
| 220 |
var minprice = $(this).data('minprice');
|
226 |
var minprice = $(this).data('minprice');
|
| 221 |
$('#variantscount').html(variants.length);
|
227 |
$('#variantscount').html(variants.length);
|
| 222 |
for(var i in variants){
|
228 |
for(var i in variants){
|
| - |
|
229 |
if(variants[i].gross_price && variants[i].gross_price > variants[i].available_price) {
|
| - |
|
230 |
var priceToDisplay = variants[i].gross_price;
|
| - |
|
231 |
}else{
|
| 223 |
if(minprice == variants[i].available_price) {
|
232 |
var priceToDisplay = variants[i].available_price;
|
| - |
|
233 |
}
|
| - |
|
234 |
if(minprice == priceToDisplay) {
|
| 224 |
var html = '<div class="clearfix varnts"></div><div class="col-xs-6 varnts text-small">'+variants[i].name+'</div><div class="col-xs-6 varnts viewproduct" data-source="'+variants[i].source_id+'" data-price="'+variants[i].available_price+'" data-url="'+variants[i].url+'" data-id="'+variants[i].id+'"><span class="cashbackrupee varnts text-right" ></span> <span class="storeminprice">'+variants[i].available_price+'</span><span class="cashbackamount">'+getcashbackstring(variants[i].cash_back_type,variants[i].cash_back)+'</span><span class="pull-right arrowright"></span>';
|
235 |
var html = '<div class="clearfix varnts"></div><div class="col-xs-6 varnts text-small">'+variants[i].name+'</div><div class="col-xs-6 varnts viewproduct" data-source="'+variants[i].source_id+'" data-price="'+priceToDisplay+'" data-url="'+variants[i].url+'" data-id="'+variants[i].id+'"><span class="cashbackrupee varnts text-right" ></span> <span class="storeminprice">'+priceToDisplay+'</span><span class="cashbackamount">'+getcashbackstring(variants[i].cash_back_type,variants[i].cash_back)+'</span><span class="pull-right arrowright"></span>';
|
| 225 |
} else {
|
236 |
} else {
|
| 226 |
var html = '<div class="clearfix varnts"></div><div class="col-xs-6 varnts text-small">'+variants[i].name+'</div><div class="col-xs-6 varnts viewproduct" data-source="'+variants[i].source_id+'" data-price="'+variants[i].available_price+'" data-url="'+variants[i].url+'" data-id="'+variants[i].id+'"><span class="cashbackrupee varnts text-right" ></span> <span>'+variants[i].available_price+'</span><span class="cashbackamount">'+getcashbackstring(variants[i].cash_back_type,variants[i].cash_back)+'</span><span class="pull-right arrowright"></span>';
|
237 |
var html = '<div class="clearfix varnts"></div><div class="col-xs-6 varnts text-small">'+variants[i].name+'</div><div class="col-xs-6 varnts viewproduct" data-source="'+variants[i].source_id+'" data-price="'+priceToDisplay+'" data-url="'+variants[i].url+'" data-id="'+variants[i].id+'"><span class="cashbackrupee varnts text-right" ></span> <span>'+priceToDisplay+'</span><span class="cashbackamount">'+getcashbackstring(variants[i].cash_back_type,variants[i].cash_back)+'</span><span class="pull-right arrowright"></span>';
|
| 227 |
}
|
238 |
}
|
| 228 |
if(variants[i].gross_price && variants[i].gross_price>0){
|
239 |
if(variants[i].gross_price && variants[i].gross_price>0){
|
| 229 |
html += '<p class="text-small">'+getGrossPriceText(variants[i].gross_price,variants[i].available_price)+'</p>';
|
240 |
html += '<p class="text-small">'+getGrossPriceText(variants[i].gross_price,variants[i].available_price)+'</p>';
|
| 230 |
}
|
241 |
}
|
| 231 |
if(variants[i].offer.length>0){
|
242 |
if(variants[i].offer.length>0){
|
| Line 314... |
Line 325... |
| 314 |
format: "json"
|
325 |
format: "json"
|
| 315 |
},
|
326 |
},
|
| 316 |
// Work with the response
|
327 |
// Work with the response
|
| 317 |
success: function( response ) {
|
328 |
success: function( response ) {
|
| 318 |
if(response.success && response.type=='redirect'){
|
329 |
if(response.success && response.type=='redirect'){
|
| - |
|
330 |
console.log(store);
|
| 319 |
if(store == 5) {
|
331 |
if(store == 5) {
|
| 320 |
//check if shopclues is active or not
|
332 |
//check if shopclues is active or not
|
| 321 |
active = getCookie('shopcluesActive',1);
|
333 |
active = getCookie('shopcluesActive',1);
|
| 322 |
if(active && active == 'true'){
|
334 |
if(active && active == 'true'){
|
| 323 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
335 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
| Line 328... |
Line 340... |
| 328 |
$('#loadingModal').modal('hide');
|
340 |
$('#loadingModal').modal('hide');
|
| 329 |
showShopcluesPopup(response.url);
|
341 |
showShopcluesPopup(response.url);
|
| 330 |
}
|
342 |
}
|
| 331 |
} else if(store == 6 ) {
|
343 |
} else if(store == 6 ) {
|
| 332 |
//display paytm help
|
344 |
//display paytm help
|
| - |
|
345 |
if(needToDisplayPaytmPopup(me)){
|
| 333 |
showPaytmHelpPopup();
|
346 |
showPaytmHelpPopup();
|
| - |
|
347 |
$('#oktatabyebye').on('click',function(){
|
| - |
|
348 |
redirectToPaytm(response.url);
|
| - |
|
349 |
});
|
| - |
|
350 |
}else{
|
| 334 |
setTimeout(function(){redirectToPaytm(response.url);},3000);
|
351 |
redirectToPaytm(response.url);
|
| - |
|
352 |
}
|
| 335 |
} else if (store == 3 || store == 2) {
|
353 |
} else if (store == 3 || store == 2) {
|
| 336 |
if (store == 2){
|
354 |
if (store == 2){
|
| 337 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
355 |
response.url = 'http://mobilehotindia.com/r.html?'+Base64.encode(response.url);
|
| 338 |
}
|
356 |
}
|
| 339 |
if(response.showmessage == 1) {
|
357 |
if(response.showmessage == 1) {
|
| Line 583... |
Line 601... |
| 583 |
}
|
601 |
}
|
| 584 |
return "";
|
602 |
return "";
|
| 585 |
}
|
603 |
}
|
| 586 |
}
|
604 |
}
|
| 587 |
|
605 |
|
| - |
|
606 |
function needToDisplayPaytmPopup(me){
|
| - |
|
607 |
var id = 'tip'
|
| - |
|
608 |
var cname = 'paytm-help-count-'+me+'-'+id;
|
| - |
|
609 |
var cookieval = getCookie(cname,1);
|
| - |
|
610 |
if(!cookieval || cookieval == 'NaN' || cookieval==''){
|
| - |
|
611 |
incrementPopupCount(id,0,'paytm-help-count-');
|
| - |
|
612 |
return true;
|
| - |
|
613 |
} else if(cookieval < 5) {
|
| - |
|
614 |
incrementPopupCount(id,cookieval,'paytm-help-count-');
|
| - |
|
615 |
return true;
|
| - |
|
616 |
} else{
|
| - |
|
617 |
return false;
|
| - |
|
618 |
}
|
| - |
|
619 |
};
|
| - |
|
620 |
|
| 588 |
function showpopup(id,count,interval){
|
621 |
function showpopup(id,count,interval){
|
| 589 |
var cname = 'notif-count-'+me+'-'+id;
|
622 |
var cname = 'notif-count-'+me+'-'+id;
|
| 590 |
var cookieval = getCookie(cname,1);
|
623 |
var cookieval = getCookie(cname,1);
|
| 591 |
var cname = 'notif-lastshown-'+me+'-'+id;
|
624 |
var cname = 'notif-lastshown-'+me+'-'+id;
|
| 592 |
var lastshown = getCookie(cname,1);
|
625 |
var lastshown = getCookie(cname,1);
|
| Line 825... |
Line 858... |
| 825 |
$('#loadingModal').modal('hide');
|
858 |
$('#loadingModal').modal('hide');
|
| 826 |
$(this).addClass('activebrand');
|
859 |
$(this).addClass('activebrand');
|
| 827 |
document.location = url+'&brands='+brands;
|
860 |
document.location = url+'&brands='+brands;
|
| 828 |
});
|
861 |
});
|
| 829 |
});
|
862 |
});
|
| - |
|
863 |
$(document).on('click','.shownexttip',function(e){
|
| - |
|
864 |
$(this).addClass('hidden').remove();
|
| - |
|
865 |
$('#firsttip').addClass('hidden').remove();
|
| - |
|
866 |
$('#secondtip').removeClass('hidden');
|
| - |
|
867 |
$('.gotit').removeClass('hidden');
|
| - |
|
868 |
});
|
| 830 |
var Base64 = {
|
869 |
var Base64 = {
|
| 831 |
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
870 |
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
| 832 |
encode: function(input) {
|
871 |
encode: function(input) {
|
| 833 |
var output = "";
|
872 |
var output = "";
|
| 834 |
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
873 |
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|