| Line 41... |
Line 41... |
| 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 fetchLivePrice(obj){
|
45 |
function fetchLivePrice(obj){
|
| 46 |
ga('send', 'event', 'liveprice', 'fetch', $(obj).data('bundle_id'));
|
46 |
ga('send', 'event', 'liveprice', 'fetch',$('#bestpriceproductname').html());
|
| 47 |
var properties = {};
|
47 |
var properties = {};
|
| 48 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
48 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
| - |
|
49 |
properties.product_name = String($('#bestpriceproductname').html());
|
| 49 |
pma.send('products','livesprice','fetch',me,properties);
|
50 |
pma.send('products','livesprice','fetch',me,properties);
|
| 50 |
var that = obj;
|
51 |
var that = obj;
|
| 51 |
var inStock = false;
|
52 |
var inStock = false;
|
| 52 |
var req = $.ajax({
|
53 |
var req = $.ajax({
|
| 53 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
54 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
| Line 102... |
Line 103... |
| 102 |
$('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback);
|
103 |
$('#bestprice').html(globalminprice).siblings('.cashbackamount').html(globalmincashback);
|
| 103 |
$('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
|
104 |
$('#beststorelink').data('id',globalminsku).data('source',globalminsource).data('price',globalminprice).data('url',globalminurl).removeClass('hidden');
|
| 104 |
$('#bestpricecontainer').removeClass('hidden');
|
105 |
$('#bestpricecontainer').removeClass('hidden');
|
| 105 |
}
|
106 |
}
|
| 106 |
} else{
|
107 |
} else{
|
| 107 |
ga('send', 'event', 'liveprice', 'outofstock', response.products[0]._id);
|
108 |
ga('send', 'event', 'liveprice', 'outofstock', $('#bestpriceproductname').html());
|
| 108 |
var properties = {};
|
109 |
var properties = {};
|
| 109 |
properties.sku = String(response.products[0]._id);
|
110 |
properties.sku = String(response.products[0]._id);
|
| - |
|
111 |
properties.source = String(response.products[0].source_id);
|
| - |
|
112 |
properties.product_name = String($('#bestpriceproductname').html());
|
| 110 |
pma.send('products','livescore','outofstock',me,properties);
|
113 |
pma.send('products','livescore','outofstock',me,properties);
|
| 111 |
outOfStockCount++;
|
114 |
outOfStockCount++;
|
| 112 |
$(that).parent().parent().remove();
|
115 |
$(that).parent().parent().remove();
|
| 113 |
}
|
116 |
}
|
| 114 |
if(!response.products[0].available_price){
|
117 |
if(!response.products[0].available_price){
|