| Line 36... |
Line 36... |
| 36 |
}
|
36 |
}
|
| 37 |
if(response.products[i].available_price <= minprice) {
|
37 |
if(response.products[i].available_price <= minprice) {
|
| 38 |
minprice = response.products[i].available_price;
|
38 |
minprice = response.products[i].available_price;
|
| 39 |
minpriceindex = i;
|
39 |
minpriceindex = i;
|
| 40 |
}
|
40 |
}
|
| - |
|
41 |
console.log(response);
|
| 41 |
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});
|
42 |
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});
|
| 42 |
}
|
43 |
}
|
| 43 |
if(i>0){
|
44 |
if(i>0){
|
| 44 |
var variantslink = $('<span class="variants">+ '+i+' Options</span>');
|
45 |
var variantslink = $('<span class="variants">+ '+i+' Options</span>');
|
| 45 |
$(that).parent().append(variantslink);
|
46 |
$(that).parent().append(variantslink);
|
| Line 67... |
Line 68... |
| 67 |
});
|
68 |
});
|
| 68 |
});
|
69 |
});
|
| 69 |
}
|
70 |
}
|
| 70 |
$(document).on('click','.variants',function(){
|
71 |
$(document).on('click','.variants',function(){
|
| 71 |
$('.storeproductinfo').empty();
|
72 |
$('.storeproductinfo').empty();
|
| 72 |
var variants = $(this).data('variants');
|
73 |
var variants = $(this).data('variants');
|
| - |
|
74 |
$('#variantscount').html(variants.length);
|
| 73 |
for(var i in variants){
|
75 |
for(var i in variants){
|
| 74 |
console.log(variants[i]);
|
76 |
console.log(variants[i]);
|
| 75 |
var row = $('<div class="row storeproductinfo"><div class="col-xs-8">'+variants[i].source_product_name+'</div><div class="col-xs-3">'+variants[i].available_price+'</div><div class="col-xs-1"><button class="btn btn-primary btn-xs viewproduct" type="button" data-id="'+variants[i].id+'">Buy</button></div></div>');
|
77 |
var row = $('<div class="row storeproductinfo"><div class="col-xs-7">'+variants[i].source_product_name+'</div><div class="col-xs-3">'+variants[i].available_price+'</div><div class="col-xs-2"><button class="btn btn-primary btn-xs viewproduct" type="button" data-id="'+variants[i].id+'">Buy</button></div></div>');
|
| 76 |
$('#storeproducts').parent().append(row);
|
78 |
$('#storeproducts').parent().append(row);
|
| 77 |
}
|
79 |
}
|
| - |
|
80 |
// console.log($(this).parent());
|
| - |
|
81 |
$('#storename').html($(this).parent().data('storename'));
|
| 78 |
$('#variantModal').modal();
|
82 |
$('#variantModal').modal();
|
| 79 |
});
|
83 |
});
|
| 80 |
$('.categorytab').on('click','.categorytabcontrol.active',function(){
|
84 |
$('.categorytab').on('click','.categorytabcontrol.active',function(){
|
| 81 |
$(this).toggleClass('active');
|
85 |
$(this).toggleClass('active');
|
| 82 |
$('#preferences-'+$(this).data('id')).addClass('hidden');
|
86 |
$('#preferences-'+$(this).data('id')).addClass('hidden');
|