| Line 35... |
Line 35... |
| 35 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
35 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
| 36 |
// Tell jQuery we're expecting JSONP
|
36 |
// Tell jQuery we're expecting JSONP
|
| 37 |
dataType: "json",
|
37 |
dataType: "json",
|
| 38 |
// Tell YQL what we want and that we want JSON
|
38 |
// Tell YQL what we want and that we want JSON
|
| 39 |
method: 'get',
|
39 |
method: 'get',
|
| 40 |
// timeout: 30000,
|
40 |
timeout: 30000,
|
| 41 |
// Work with the response
|
41 |
// Work with the response
|
| 42 |
success: function( response ) {
|
42 |
success: function( response ) {
|
| 43 |
if(response.success){
|
43 |
if(response.success){
|
| 44 |
var i = 0;
|
44 |
var i = 0;
|
| 45 |
var minpriceindex = 0;
|
45 |
var minpriceindex = 0;
|
| Line 52... |
Line 52... |
| 52 |
// var i = 0;
|
52 |
// var i = 0;
|
| 53 |
for(var i in response.products){
|
53 |
for(var i in response.products){
|
| 54 |
if(response.products[i].in_stock == 1){inStock = true;}
|
54 |
if(response.products[i].in_stock == 1){inStock = true;}
|
| 55 |
// console.log(response.products[i]);
|
55 |
// console.log(response.products[i]);
|
| 56 |
if(response.products[i].available_price && response.products[i].available_price < globalminprice) {
|
56 |
if(response.products[i].available_price && response.products[i].available_price < globalminprice) {
|
| 57 |
globalminprice = response.products[i].available_price;
|
57 |
globalminprice = Math.round(response.products[i].available_price);
|
| 58 |
globalminsku = response.products[i]._id;
|
58 |
globalminsku = response.products[i]._id;
|
| 59 |
}
|
59 |
}
|
| 60 |
if(response.products[i].available_price <= minprice) {
|
60 |
if(response.products[i].available_price <= minprice) {
|
| 61 |
minprice = response.products[i].available_price;
|
61 |
minprice = Math.round(response.products[i].available_price);
|
| 62 |
minpriceindex = i;
|
62 |
minpriceindex = i;
|
| 63 |
}
|
63 |
}
|
| 64 |
variants.push({'available_price' : response.products[i].available_price, 'url' : response.products[i].marketPlaceUrl,'source_product_name' : response.products[i].source_product_name,'id' : response.products[i]._id});
|
64 |
variants.push({'available_price' : Math.round(response.products[i].available_price), 'url' : response.products[i].marketPlaceUrl,'source_product_name' : response.products[i].source_product_name,'id' : response.products[i]._id});
|
| 65 |
}
|
65 |
}
|
| 66 |
if(i>0){
|
66 |
if(i>0){
|
| 67 |
var variantslink = $('<span class="variants">+ '+i+' Options</span>');
|
67 |
var variantslink = $('<span class="variants">+ '+i+' Options</span>');
|
| 68 |
$(that).parent().append(variantslink);
|
68 |
$(that).parent().append(variantslink);
|
| 69 |
$(variantslink).data('variants',variants)
|
69 |
$(variantslink).data('variants',variants)
|