‘); $(‘.article-container-‘+skuoos.replace(/\./g, « »)).append( »); $(‘.ProductListElement__capsule[data-product-code= »‘ + skuoos + ‘ »]’).css(‘padding-bottom’, ’20px’); }); } }); } } }); }); clearInterval(checkproductsready); } // Ajouter des Similaires sur les cafés en rupture de stock dans PDP if ($(‘.ProductDetails__information’).length) { var pdpcomp $(window.ui).each(function () { if ($(this)[0].module == ‘ProductDetails’) { pdpcomp = $(this)[0]; } }); if(pdpcomp.configuration.eCommerceData.product.inStock ==false){ var skuok = pdpcomp.configuration.eCommerceData.product.legacyId $(skumapping).each(function () { if ($(this)[0].old == skuok) { var skuoos = $(this)[0].Agé de; var skunew = $(ceci)[0].Nouveau; var getProduct = napi.catalog().getProduct(skunew) getProduct.then(function (value) { skunamenew = value.name skuurlnew = value.pdpURLs.desktop $(‘.ProductDetails__information’).append( »); }) ; } }); } clearInterval(checkproductsready); } }, 100); } $(fonction() { outOfStockSimilarProducts() });
‘); $(‘.article-container-‘+skuoos.replace(/\./g, « »)).append( »); $(‘article.ProductListElement__capsule[data-product-code= »‘ + skuoos + ‘ »]’).css(‘padding-bottom’, ’20px’); }); } // Ajouter bientôt l’étiquette $(‘article.ProductListElement__capsule[data-product-code= »‘ + skuoos + ‘ »] h3’).append(‘‘+phaseoutsoonlabel+’‘); } }); } }); }); clearInterval(checkproductsready); } // Ajouter des Similaires sur les cafés en rupture de stock dans PDP if ($(‘.ProductDetails__information’).length) { var pdpcomp $(window.ui).each(function () { if ($(this)[0].module == ‘ProductDetails’) { pdpcomp = $(this)[0]; } }); var skuok = pdpcomp.configuration.eCommerceData.product.legacyId $(skumapping).each(function () { if ($(this)[0].old == skuok) { var skuoos = $(this)[0].Agé de; var skunew = $(ceci)[0].Nouveau; var getProduct = napi.catalog().getProduct(skunew) getProduct.then(function (value) { skunamenew = value.name skuurlnew = value.pdpURLs.desktop $(‘.ProductDetails__information’).append( »); }) ; } }); clearInterval(checkproductsready); } }, 100); } $(fonction() { SoonoutOfStockSimilarProducts() });
« + » »+ »
« +attributs.html()+ »
« + « » ; // Partie médiane html+= «
« +Onglet Traductions[‘productFeatureBitterness’]+ »« ; if (data.capsuleProperties.bitterness>0){for (var i=1;i »; else html+= »« ;} sinon html+= »« ; html+= «
« + »
« +Onglet Traductions[‘productFeatureAcidity’]+ »« ; if (data.capsuleProperties.acidity>0) {for (var i=1;i »; else html+= »« ;} sinon html+= »« ; html+= «
« + »
« + »« + »
« ; pour (var je = 1; je »; sinon html + = « « ; html+= « « +Onglet Traductions[‘productFeatureBody’]+ »
« + »
« ; if (data.capsuleProperties.roastLevel>0) {for (var i=1;i »; else html+= »« ;} sinon html+= »« ; html+= « « +Onglet Traductions[‘productFeatureRoasting’]+ »
« + »
« + »
« + »
« ; // Dernière partie html+= « »+ « »; popin.html(html); // Supprime les propriétés si un élément manque (acidité, corps, …) if ( (!data.capsuleProperties.bitterness>0 ) || (!data.capsuleProperties.roastLevel>0) || (!data.capsuleProperties.acidity>0) || (!bodylevel>0) ){ $(« #coffee_PLP_popin_content .property > * »).remove() ; $(« #coffee_PLP_popin_content .property »).addClass(« empty »); $(« #coffee_PLP_popin_content .product_intensity »).addClass(« nointensity barista »); } mosaic.initializeAllFreeHTMLModules(document.getElementById(‘ctas’)) ; } function displayUnEnrichedPopIn(data, obj){ var html= » »; var price=obj.find(« .product_price »).html(); // Obtenir la description du produit, trouver la bonne description à utiliser var description=$( «
« + « » ; // Partie médiane html+= «
« + »
« ; // Dernière partie html+= « »; popin.html(html); mosaic.initializeAllFreeHTMLModules(document.getElementById(‘ctas’)); } // Variables de fonction var parent=obj.parent(); var sku=parent .attr(« data-product-code »); var popin=$(« #coffee_PLP_popin_content »); // Obtenir le haut de l’en-tête pour ajuster la taille du wrapper popin var htop=$(« #header .Header__top-wrapper »).height( ); $(« #coffee_PLP_popin_wrapper »).css(« top », htop+ »px »); $(« #coffee_PLP_popin_wrapper »).css(« height », « calc(100% – « +htop+ »px) ») ; // Clearn popin popin.html(« »); // Fait pour que napi renvoie les données de l’objet window.napi.catalog().getProduct(sku).then(function (data) { var EnrichedTab = getEnrichedTab(data.internationalId ); var enriched=EnrichedTab[‘enriched’]; si (data.unitQuantity>1) enrichi=false ; // Type de popin à afficher : enrichi ou non ? if (enriched===true) displayEnrichedPopIn(data, obj); sinon displayUnEnrichedPopIn(data, obj); // Ajouter des cafés OOS similaires au bas de la popin var parent=obj.parent(); if (parent.parent().find(« .oos-similar-coffee »).length){ var popin=$(« #coffee_PLP_popin_content »); var oos=parent.parent().find(« .oos-similar-coffee »).html(); popin.append(«
« +oos+ »
« ); } // Afficher lorsque les images sont chargées var imgs_loaded=0; $(« .popin_product_img »).each(function(){ $(this).on(« load », function(){ $(this).removeClass (« loading »); }) .attr(« src », $(this).attr(« data-src »)) .attr(« srcset », $(this).attr(« data-src »)+ « ?impolicy=product&imwidth=150 1x, « +$(this).attr(« data-src »)+ »?impolicy=product&imwidth=230 1.5x, « +$(this).attr(« data-src ») + »?impolicy=product&imwidth=300 2x ») }); // Afficher le popin $(« #coffee_PLP_popin_wrapper »).addClass(« show »); }); } // Ouvrir le popin $(document).on( « click », « .ProductListElement__capsule a », function(e){ if ($(this).attr(« href »)!= »javascript : void(0); »){ e.stopPropagation(); e.preventDefault (); openCoffeePLPpopin($(this)); $(‘body’).addClass(« PLP-popin-opened »); // Suivi GA : popin ouvert gtmDataObject.push({ event : ‘customEvent’, // Obligatoire as is eventRaisedBy: ‘FreeHTML’, // Obligatoire as is eventCategory: ‘Coffee PLP’, // ie: « User Engagement » eventAction: ‘Click’, // ie: « Click » eventLabel: ‘Open Popin’, nonInteraction: 0, // 0 si l’événement est causé par l’interaction de l’utilisateur, 1 sinon }); } }); // Ferme le popin $(« #coffee_PLP_popin_BG, #coffee_PLP_popin_close »).on(« click », function(){ if (!$(‘body’).hasClass(« has-overlay »)) {$(« #coffee_PLP_popin_wrapper « ).removeClass(« show »);$(‘body’).removeClass(« PLP-popin-opened »);} }); // Empêcher le lien de suivre le clic sur le bouton du panier $(document).on(« click », « .product_buy »,function(e ) { // Empêcher le clic du lien et le réactiver après 1 seconde var link=$(this).parent (« a »); var href=link.attr(« href »); link.off(« click »).attr(‘href’, « javascript: void(0); »); setTimeout(function(){ lien.attr(‘href’, lien); }, 750); } ); } activateCoffeePLPpopin(); /* window.gtmDataObject.push({ event: ‘optimize.newPLPReadyForPopin’ }); // URL PLP ON var URLactuelle = window.location.href; if(currentURL.indexOf(« forcePOPIN= »)>0){activateCoffeePLPpopin();} */