");
index_product++;
html_product += ""+html+"
";
if((index_product) == vitrine_arr.length){
render_product(box_vitrine, arr_flexslide, true, box_slider);
sessionStorage.setItem(session_storage+'HTML', html_product);
}
}
});
});
});
}else{
$(box_vitrine + ' .swiper-wrapper').append(sessionStorage.getItem(session_storage+'HTML'));
render_product(box_vitrine, arr_flexslide, true, box_slider);
}
}
}
}
}
/** Promocao Destaque **/
function render_destaque(){
var vitrine_qtde = "3";
var vitrine = "33989870,33989842,33986039,33989319";
var box_vitrine = '#promocao-destaque';
var session_storage = 'promocaoDestaque';
var vitrine_status = "0";
var box_slider = '.flexslider-promocao-destaque';
$(box_vitrine).hide();
if(vitrine_status == '1'){
if(vitrine.length > 0){
var vitrine_arr = vitrine.split(',');
const arr_flexslide = {
min: vitrine_qtde,
max: vitrine_qtde,
total: vitrine_qtde
}
if(vitrine_arr.length > 0){
$(box_vitrine + ' ul').empty();
$(vitrine_arr).each((i, v) => {
if(i {
$.ajax({
url: '/' + res.Product.slug,
async: true
}).done( (ress) => {
const produto = $(ress).find('#product-ajax');
const html = String(produto[0].innerHTML);
if(html.length > 0 && $(box_vitrine).length > 0){
$(box_vitrine + ' ul.list-product').append(""+html+"");
render_product(box_vitrine, arr_flexslide, false, box_slider);
}
});
});
} else {
$.ajax({
url: '/web_api/products/' + v,
async: true
}).done( (res) => {
$.ajax({
url: '/' + res.Product.slug,
async: true
}).done( (ress) => {
const produto = $(ress).find('#product-row-ajax');
const html = String(produto[0].innerHTML);
if(html.length > 0 && $(box_vitrine).length > 0){
$(box_vitrine + ' ul.list-product').append(""+html+"");
//$(box_vitrine + ' ul.list-product .listagem-produtos-timer-promocao').remove();
render_product(box_vitrine, arr_flexslide, false, box_slider);
}
});
});
}
});
}
}
}
}
}(jQuery));