Pagamento

`); let swiper = new Swiper(box +' '+ slider_box, { slidesPerView: arr_flexslide.total, speed: 400, effect: 'slide', spaceBetween: 10, lazy: { loadPrevNext: true, }, navigation: { nextEl: box +' '+ slider_box +' .next', prevEl: box +' '+ slider_box +' .prev' }, loop: false, observer: true, observeParents: true, breakpoints :{ 0 :{ slidesPerView : arr_flexslide.total, }, }, pagination: { el : box +' '+ slider_box +' .dots', type : 'bullets', bulletClass : 'dot', bulletActiveClass : 'dot-active', clickable : true }, on: { init: function () { $(box +' '+ slider_box).addClass('show'); }, } }); } theme.loadVitrinePersonalizadaTimer(); theme.loadProdutosTimer(); $(box+' .select-cor').each(function(){ if($(this).find(' > option').length == 0){ $(this).parents('.config-variacoes-compra').find(' > .select-tamanho').show(); $(this).parents('.config-variacoes-compra').find(' > .select-tamanho option').show(); $(this).parents('.config-variacoes-compra').find(' > .select-tamanho option:first').attr('selected', true); } }); $(box).show(); return true; } return false; } $(document).ready(() => { $(document).on("change", '.select-tamanho', function(){ var variacao = $(this).val(); var estoque = $(this).find('option:selected').attr('estoque'); $(this).parents('.config-variacoes-compra').find(' > input[name=variacao]').val(variacao); $(this).parents('.config-variacoes-compra').find(' > input[name=estoque]').val(estoque); }); }); /** Menu categoria Produto **/ function render_menu(){ const menu_categoria = { 1: "", 2: "", 3: "", 4: "", 5: "", 6: "", 7: "", 8: "", 9: "", 10: "", 11: "", 12: "", 13: "", 14: "", 15: "" }; const menu_session = ['A', 'B', 'C', 'D', 'E', 'F', 'G', "H", 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P']; var new_menu_product = []; Object.keys(menu_categoria).map((k) => { if(menu_categoria[k].length > 0){ new_menu_product.push({ 'key': k, 'value': menu_categoria[k], 'session':menu_session[k] }); } }); if(new_menu_product.length > 0){ $(new_menu_product).each((i, v) => { var box = ".menu-categoria-product-"+v.key; var session_storage = 'menuCategoriaProduct'+v.session; const session_status = getProducts([v.value], box, session_storage); if(!session_status){ $.ajax({ url: url_vitrine + '/web_api/products/' + v.value, async: true }).done( (res) => { $.ajax({ url: url_vitrine + '/' + res.Product.slug, async: true }).done( (res) => { const produto = $(res).find('#product-menu-ajax'); const html = String(produto[0].innerHTML); if(html.length > 0 && $(box).length > 0){ $(box).append(html); sessionStorage.setItem(session_storage+'HTML', html); } }); }); }else{ $(box).append(sessionStorage.getItem(session_storage+'HTML')); render_product(box, [], false, true); } }); } } /** Vitrine personalizada **/ function render_vitrine(){ var vitrine_qtde = "4"; var vitrine = ""; var box_vitrine = '#vitrine-personalizada'; var session_storage = 'vitrinePersonalizada'; var vitrine_status = "0"; var box_slider = '.swiper-produtos'; $(box_vitrine).hide(); if(vitrine_status == '1'){ if(vitrine.length > 0){ var vitrine_arr = vitrine.split(','); html_product = ''; var index_product = 0; const arr_flexslide = { min: vitrine_qtde, max: vitrine_qtde, total: vitrine_qtde } if(vitrine_arr.length > 0){ const session_status = getProducts(vitrine_arr, box_vitrine, session_storage); if(!session_status){ $(vitrine_arr).each((i, v) => { $.ajax({ url: url_vitrine + '/web_api/products/' + v, async: true }).done( (res) => { $.ajax({ url: url_vitrine + '/' + 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+"
  • "); 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 + ' ul.list-product').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 = ""; var box_vitrine = '#promocao-destaque'; var session_storage = 'promocaoDestaque'; var vitrine_status = "0"; var box_slider = '.swiper-promocao-destaque'; $(box_vitrine).hide(); if(vitrine_status == '1'){ if(vitrine.length > 0){ var vitrine_arr = vitrine.split(','); html_product_promo = ''; var index_product = 0; const arr_flexslide = { min: vitrine_qtde, max: vitrine_qtde, total: vitrine_qtde } if(vitrine_arr.length > 0){ const session_status = getProducts(vitrine_arr, box_vitrine, session_storage); if(!session_status){ $(vitrine_arr).each((i, v) => { $.ajax({ url: url_vitrine + '/web_api/products/' + v, async: true }).done( (res) => { $.ajax({ url: url_vitrine + '/' + 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+"
  • "); index_product++; html_product_promo += "
  • "+html+"
  • "; if((index_product) == vitrine_arr.length){ render_product(box_vitrine, arr_flexslide, true, box_slider); sessionStorage.setItem(session_storage+'HTML', html_product_promo); } } }); }); }); }else{ $(box_vitrine + ' ul.list-product').append(sessionStorage.getItem(session_storage+'HTML')); render_product(box_vitrine, arr_flexslide, true, box_slider); } } } } }; function render_produto_banner(){ const banners_full = [ { index: 1, link: '', produto: '', session: 'A' }, { index: 2, link: '', produto: '', session: 'B' }, { index: 3, link: 'https://www.lorylingerie.com/lingerie/conjunto-fascinio?variant_id=4221', produto: '', session: 'C' } ]; $(banners_full).each((i, v) => { var box = ".banner-full-product-"+v.index; var session_storage = 'bannerFullProduct'+v.session; const session_status = getProducts([v.produto], box, session_storage); if( v.produto.length > 0){ if(!session_status){ $.ajax({ url: url_vitrine + '/web_api/products/' + v.produto, async: true }).done( (res) => { $.ajax({ url: url_vitrine + '/' + res.Product.slug, async: true }).done( (res) => { const produto = $(res).find('#product-banner-ajax'); const html = String(produto[0].innerHTML); if(html.length > 0 && $(box).length > 0){ $(box).append(html); sessionStorage.setItem(session_storage+'HTML', html); } }); }); }else{ $(box).append(sessionStorage.getItem(session_storage+'HTML')); render_product(box, [], false, true); } } }); } }(jQuery));