`; }; $(document).ready(function () { //var cmp = '#cmp_20181015_104612'; // promo dipendenti live //var cmp = '#cmp_20210114_144219'; // homepage_2021 //var cmp = '#cmp_20210208_092646'; // homepage_2021_def var cmp = "#cmp_20230613_101545"; // homepage_2021_def //wuerthitaly_clearPage(cmp, 1, 0, 1, 0, 0); /* edit */ wuerthitaly_clearPage(cmp, 0, 1, 1, 0, 0); /* live */ $("title").html( "Würth Italia: prodotti e sistemi di fissaggio professionali" ); var homepage_custom = "common_hp"; if (wuerthitaly_getCookie("homepage_custom").length > 0) { if ( wuerthitaly_getCookie("homepage_custom") != "industria" && wuerthitaly_getCookie("homepage_custom") != "clienti-nuovi" ) { homepage_custom = wuerthitaly_getCookie("homepage_custom"); } } else { wuerthitaly_setCookie("homepage_custom", "common_hp", 7); homepage_custom = "common_hp"; } // verifico l'esistenza di un cookie del tipo homepage_custom // il cookie esiste? // si -> l'utente ha scelto di avere un'esperienza utente personalizzata // no -> l'utente non vuole avere un'esperienza di navigazione personalizzata // se fa login nelle welcomepage, settiamo esperienza di navigazione? initPopolaLanding(cmp, homepage_custom); var pwrtl_1 = 6403; var pwrtl_2 = 6423; var pwrtl_3 = 6443; var customerno = wuerthitaly_getCookie("customerno"); if (customerno) { getRelatedProductsCHRV2(customerno); } getRelatedPoductsBES(); const generateSet = (product) => { if (product?.isFallback) { return product; } let set = randomSetIntFromInterval(0, product.length - 1, 3); let selectedproduct = [product[set[0]], product[set[1]], product[set[2]]]; return selectedproduct; }; call4data([3143], "outlet", true).then((value) => { populateCategoryWidget(generateSet(value), "outlet"); }); call4data([6604], "thinkbig").then((value) => { populateCategoryWidget(generateSet(value), "thinkbig"); }); call4data([pwrtl_1, pwrtl_2, pwrtl_3], "pwrtool").then((value) => { populateCategoryWidget(generateSet(value), "pwrtool"); }); call4data(["nojson"], "newprod").then((value) => { populateCategoryWidget(generateSet(value), "newprod"); }); //CTA configuratore PNRR + fidelity if ( wuerthitaly_dateCheck( "09/10/2022" + "/0/0/0/000", "31/12/2023" + "/08/15/59/999" ) === "current" ) { let existingNode = $( "#categoriesrHp > div.container-fluid-newmax > #configuratorePNRRSection" ); document.querySelector( "#categoriesrHp > div.container-fluid-newmax > #configuratorePNRRSection" ); const templateCOL = (Specials) => { let colInner = ""; for (let i = 0; i < Specials.length; i++) { let obj = Specials[i]; colInner += `
${obj.title}
${obj.paragraph}
${obj.cta}
`; } return colInner; }; const Specials = [ { title: "Configuratore PNRR", paragraph: "Scopri in pochi click quali prodotti Würth godono di agevolazioni pubbliche previste dal piano PNRR", href: "https://eshop.wuerth.it/agevolazioni/incentivi.cyid/incentivi.cgid/it/IT/EUR/", cta: "Scopri i prodotti e le agevolazioni", img: "/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/2023/06-giugno/pnrr.png", }, { title: "È arrivata Würth Fidelity", paragraph: "La novità che premia la tua fedeltà", href: "https://fidelity.wuerth.it/home.html", cta: "Scopri di più", img: "/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/2023/06-giugno/fidelity.png", }, { title: "Dai forma ai tuoi progetti
con Würth Hydro", paragraph: "Oltre 16.000 prodotti disponibili online dei migliori marchi del mondo impiantistica, condizionamento e sanitari, selezionati da Würth.", href: "https://eshop.wuerth.it/hydro/hydro.cyid/hydro.cgid/it/IT/EUR/", cta: "Scopri di più", img: "/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/2023/06-giugno/hydroWP.png", }, ]; let SpecialsSection = `
`; $(existingNode).before(SpecialsSection); } }); function string_to_slug(str) { str = str.replace(/^\s+|\s+$/g, ""); // trim str = str.toLowerCase(); // remove accents, swap ñ for n, etc var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; var to = "aaaaeeeeiiiioooouuuunc------"; for (var i = 0, l = from.length; i < l; i++) { str = str.replace(new RegExp(from.charAt(i), "g"), to.charAt(i)); } str = str .replace(/[^a-z0-9 -]/g, "") // remove invalid chars .replace(/\s+/g, "-") // collapse whitespace and replace by - .replace(/-+/g, "-"); // collapse dashes return str; } function wuerth_copyCouponCode2022(id) { var copyText = $('[data-label-coupon="' + id + '"]')[0].innerText; var textArea = document.createElement("textarea"); textArea.value = copyText; document.body.appendChild(textArea); textArea.select(); if (!textArea.value.includes("Coupon copiato!")) { document.execCommand("Copy"); } textArea.remove(); var copied = $('[data-copied-coupon="' + id + '_copied"]'); var button = $('[data-button-coupon="' + id + '_button"]'); copied.removeClass("d-none"); copied.addClass("d-flex"); button.removeClass("d-flex"); button.addClass("d-none"); setTimeout(() => { copied.removeClass("d-flex"); copied.addClass("d-none"); button.removeClass("d-none"); button.addClass("d-flex"); }, 1000); } function copyCouponCode_2(id) { var copyText = $("#" + id).text(); var textArea = document.createElement("textarea"); textArea.value = copyText; document.body.appendChild(textArea); textArea.select(); document.execCommand("Copy"); textArea.remove(); var tooltip = document.getElementById(id + "Tooltip"); tooltip.innerHTML = "Coupon copiato!"; } function infoCouponCode_2(id) { var tooltip = document.getElementById(id + "Tooltip"); tooltip.innerHTML = "Copia il coupon"; } window.onload = function () { if (window.location.hash) { elmnt = document.getElementById(window.location.hash); elmnt.scrollIntoView(true); } //$('#questoslider')[0].slick.refresh(); }; function initPopolaLanding(cmp, homepage_custom) { // renderizzo la pagina sulla base dei settaggi per ogni divisione //console.log('homepage_custom: ' + homepage_custom); var text = ""; var init_setting = wuerthitaly_filter_content( settingsHomepages, homepage_custom, "divisione" ); if (init_setting.length > 0) { text += wuerthitaly_hp_rendering(homepage_custom, "", init_setting[0]); } else { var globalHpSsettings = { blog: "863,882,881,67,880,263,883,472", rendering: [ "appSectionMobile", "slider", //"feed_BW", //"hpExperience", "categorie", "prodotti", "ferramentaOnline", "servizi", "appSection", "seoAccordion", "academySection", "newsletterSection", "blogSection", ], }; text += wuerthitaly_hp_rendering(homepage_custom, "", globalHpSsettings); } $(text).appendTo(cmp); $("div#headerUserLayerAnnymousLoginForm").clone().appendTo("#sliderLogin"); if ( $("div#headerUserLayerAnnymousLoginForm .tab-content").hasClass("pt-0") ) { $("div#headerUserLayerAnnymousLoginForm .tab-content").removeClass( "pt-0" ); $("div#headerUserLayerAnnymousLoginForm .tab-content").addClass("py-0"); } $("#sliderLogin label.custom-control.custom-checkbox.m-0").remove(); $("#sliderLogin p").remove(); //$('20€ di sconto se ti registri ora!
Non perdere questo sconto sul tuo primo ordine con un valore minimo di 99€.').insertBefore("#sliderLogin a.btn.btn-block.btn-primary.no-nav-link"); $( '15% di sconto se ti registri ora!
Non perdere questo sconto sul tuo primo ordine con un valore minimo di 99€.' ).insertBefore("#sliderLogin a.btn.btn-block.btn-primary.no-nav-link"); $("#selectProfessione") .change(function () { $("#descriptionArea").html(""); var optionValue = $(this).val(); if (optionValue != "") { var text = ""; var $selected = $(this).find(":selected"); text += '
'; text += '
'; text += '
'; text += '' + $selected.data("description") + ""; text += "
"; text += "
"; text += "
"; $("#buttonEsperienceLogin").removeAttr("disabled"); $(text).appendTo("#descriptionArea"); } else { } }) .trigger("change"); } function refreshExperience() { var selectedOption = $("#selectProfessione").val(); if (selectedOption != "") { wuerthitaly_setCookie("homepage_custom", selectedOption, 7); location.reload(); } else { var text = ""; text += '
'; text += '
'; text += '
'; text += 'Attenzione! È necessario selezionare un settore professionale.'; text += "
"; text += "
"; text += "
"; $("#buttonEsperienceLogin").attr("disabled", "disabled"); $(text).appendTo("#descriptionArea"); } } function resetExperience() { wuerthitaly_setCookie("homepage_custom", "common_hp", 7); location.reload(); } /** * wuerthitaly_filter_content * riceve un array di record e lo filtra in base alla lista di elementi relativi al paroprietà che riceve * * array: array contenente i json * search: elemento/i che devono essere contenuti nella propriety ( funziona sia con stringhe che array) * property: proprety neme che deve essere incluso nel json ( la property deve essere un array ) **/ function wuerthitaly_filter_content(array, search, property) { return array.filter(function (e) { return e[property].includes(search); }); } function wuerthitaly_hp_rendering(divisione, segmento, settings) { //var bgcolor = settings.bg-color; var rendering = settings.rendering; //console.log(bgcolor); var text = ""; for (i = 0; i < rendering.length; i++) { var section = rendering[i]; switch (section) { /*case 'promo': // console.log('sectrion: ', section ); text += wuerth_italia_wp_get_promo_section( divisione, segmento ); break;*/ case "slider": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displaySlider(divisione, segmento); // console.log("slider",text); break; case "hpExperience": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayHpExperience(divisione, segmento); //console.log("hpExperience",text); break; case "categorie": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayCategories(divisione, segmento); //console.log("categorie",text); break; case "ferramentaOnline": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayFerramentaOnline(divisione, segmento); //console.log("categorie",text); break; case "servizi": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayServices(divisione, segmento); //console.log("servizi",text); break; case "prodotti": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayProducts(divisione, segmento); //console.log("prodotti",text); break; case "seoAccordion": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displaySeoAccordion(divisione, segmento); break; case "appSection": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayAppSection(divisione, segmento); //text += WRenderBoxApp.boxApp(0); break; case "appSectionMobile": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayAppSectionMobile(divisione, segmento); break; case "academySection": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayAcademySection(divisione, segmento); break; case "newsletterSection": // console.log('sectrion: ', section ); text += wuerthitaly_hp_displayNewsletterSection(divisione, segmento); break; /*case "blogSection": //console.log('sectrion: ', section ); text += wuerthitaly_hp_displayBlogSection(divisione, segmento); break;*/ default: // console.error('default sectrion: ', section ) break; } } return text; } const renderslidesMobile = (settings) => { let text = ""; for (k = 0; k < settings.length; k++) { if ( wuerthitaly_dateCheck(settings[k]["from"], settings[k]["to"]) == "current" ) { text += '
'; if (settings[k]["sku"] == "") { var url_to = settings[k]["cta_to"]; } else { var url_to = "/-/" + settings[k]["sku"] + ".sku/it/IT/EUR/"; } if (settings[k]["type"] == 0) { text += ''; text += ''; text += ""; } if (settings[k]["type"] == 1) { text += '
'; text += ''; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; if (settings[k]["textbox"]["title"]["text"] != "") { text += '' + settings[k]["textbox"]["title"]["text"] + ""; } if (settings[k]["textbox"]["description"]["text"] != "") { text += '' + settings[k]["textbox"]["description"]["text"] + ""; } if (settings[k]["textbox"]["coupon"]["text"].length > 0) { text += '
'; for ( l = 0; l < settings[k]["textbox"]["coupon"]["text"].length; l++ ) { text += '' + settings[k]["textbox"]["coupon"]["text"][l] + ""; } text += "
"; } if (settings[k]["textbox"]["cta"]["text"] != "") { text += ''; if (settings[k]["textbox"]["cta"]["icon"] != "") { text += ' '; } text += settings[k]["textbox"]["cta"]["text"]; text += ""; } text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; } if (settings[k]["type"] == 2) { text += '
'; text += '
'; text += "
"; } text += "
"; } } return text; }; const renderslidesDesktop = (settings) => { text = ""; for (k = 0; k < settings.length; k++) { if ( wuerthitaly_dateCheck(settings[k]["from"], settings[k]["to"]) == "current" ) { text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; if (settings[k]["textbox"]["badge"]) { if (settings[k]["textbox"]["badge"]["text"] != "") { text += '
' + settings[k]["textbox"]["badge"]["text"] + "
"; } } if (settings[k]["textbox"]["title"]["text"] != "") { if (settings[k]["textbox"]["cta"]["blank"] == 0) { text += '' + settings[k]["textbox"]["title"]["text"] + ""; } else { text += '' + settings[k]["textbox"]["title"]["text"] + ""; } } if (settings[k]["textbox"]["description"]["text"] != "") { text += '' + settings[k]["textbox"]["description"]["text"] + ""; } if (settings[k]["textbox"]["coupon"]["text"].length > 0) { text += '
'; for ( l = 0; l < settings[k]["textbox"]["coupon"]["text"].length; l++ ) { text += '' + settings[k]["textbox"]["coupon"]["text"][l] + ""; } text += "
"; } if (settings[k]["textbox"]["cta"]["text"] != "") { if (settings[k]["textbox"]["cta"]["blank"] == 0) { text += ''; if (settings[k]["textbox"]["cta"]["icon"] != "") { text += ' '; } text += settings[k]["textbox"]["cta"]["text"]; text += ""; } else { text += ''; if (settings[k]["textbox"]["cta"]["icon"] != "") { text += ' '; } text += settings[k]["textbox"]["cta"]["text"]; text += ""; } } text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; } } return text; }; const renderSlider = (settings) => { var text = ""; if (settings.length > 0) { if ($(window).width() > 991) { text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += renderslidesDesktop(settings); text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; } else { // top slider per versione mobile text += '
'; text += '
'; text += '
'; text += '
'; text += renderslidesMobile(settings); text += "
"; text += "
"; text += "
"; text += "
"; wuerthitaly_activeSlider( "#homepageSliderMobile", true, 1, 1, true, true, 3000, false ); } } return text; }; const addSlider = () => { const sliderimpo = { infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, autoplay: true, autoplaySpeed: 3000, arrows: true, draggable: false, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 1, slidesToScroll: 1, dots: false, arrows: true, draggable: true, }, }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, dots: false, arrows: true, draggable: true, }, }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, dots: false, arrows: true, draggable: true, }, }, // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ], }; const trackingFunctionSlider = (e, index, event) => { const trackingName = (title) => { // console.log(title) let m = title.replace(/(\r\n|\n|\r|\/nin)/gm, " ").split(" "); const pattern = /\b(?:il|lo|la|i|gli|le|un|uno|una|l|del|dello|della|dei|degli|delle|al|allo|alla|ai|agli|alle|dal|dallo|dalla|dai|dagli|dalle|nel|nello|nella|nei|negli|nelle|sul|sullo|sulla|sui|sugli|sulle|per|di|da|con|su|fra|tra|e|o|ma|se|che)\b/gi; const p = m.filter((word) => !pattern.test(word)); const date = new Date(); const name = p[1] ? p[0] + p[1] : p[0]; return "promo_" + name.toLowerCase() + "_" + date.getFullYear(); }; let obj = { event: event, position: index, name: trackingName(e.innerText), placement: "slider_homepage", }; window.dataLayer = window.dataLayer || []; window.dataLayer.push(obj); }; const SendTracking = (e, event) => { let activeSlide = e.querySelector( ".slick-slide.slick-current.slick-active" ); let title = activeSlide.querySelector(".sliderTitle"); if (event === "banner_impression" && title.dataset.isSeen === "true") { return; } else if (event === "banner_impression") { title.dataset.isSeen = "true"; } /* if(event==='banner_impression') { if (title.dataset.isSeen = 'true') { return }else { title.dataset.isSeen = 'true' } }; */ trackingFunctionSlider(title, activeSlide.dataset.index, event); // console.log(e.querySelector('.slick-slide.slick-current.slick-active')); }; return "
"; $(document).ready(function () { $("#homePageSlider").slick(sliderimpo); }); }; function wuerthitaly_hp_displaySlider(divisione, segmento) { var selectedSlider = wuerthitaly_filter_content( sliderSettings, divisione, "divisione" ); //console.log('+++++++++++++++++++++++++++++',selectedSlider); var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Sei già un cliente?'; text += 'Accedi'; text += "
"; text += "
"; text += '
'; text += '
'; text += 'Non sei ancora registrato?'; text += 'Registrati'; text += "
"; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += "
"; text += "
"; text += '
'; text += '
'; // sezione slider text += addSlider(); text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayHpExperience(divisione, segmento) { var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Dal 13 al 24 agosto i nostri magazzini rimarranno chiusi'; text += 'Gli ordini da Online-Shop e Würth APP verranno evasi anche in questo periodo!'; text += '
'; text += 'inizia ora i tuoi acquisti'; text += '
'; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
'; if (divisione == "common_hp") { text += '
'; text += '
'; text += '
'; text += 'Aiutaci a migliorare la tua esperienza d\'acquisto'; text += "
"; text += "
"; text += "
"; text += '
'; text += ''; text += '
'; text += '"; text += "
"; text += '
'; text += ''; text += "
"; text += "
"; text += '
'; } else { text += '
'; text += '
'; text += 'Hai scelto di visualizzare la homepage dedicata a chi lavora nel settore ' + divisione + ".
Se non vuoi più personalizzare la tua esperienza di navigazione clicca sul pulsante rosso."; text += "
"; text += '
'; text += ''; text += "
"; text += "
"; text += '
'; } text += "
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += '
'; text += 'Priorità di evasione, consegna in 24/48 ore'; text += 'Oppure utilizza l\'opzione Click & Collect ordini online, ritiri la merce in 60 minuti al negozio più vicino'; text += "
"; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += '
'; text += 'Consegna gratuita per ordini sopra i 99€'; text += 'Altrimenti il costo della consegna verrà calcolato in base alle tue condizioni contrattuali'; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayCategories(divisione, segmento) { var selectedCategories = wuerthitaly_filter_content( categorySettings, divisione, "divisione" ); var text = ""; /*text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Nasce il nuovo servizio in abbonamento Würth Red,
scopri ora tutti i vantaggi pensati per te!'; text += 'scopri di più'; text += '
'; text += '
'; text += '
'; text += 'Nasce il nuovo servizio in abbonamento Würth Red,
scopri ora tutti i vantaggi pensati per te!'; text += 'scopri di più'; text += '
'; text += '
'; text += '
';*/ text += '
'; var customerno = wuerthitaly_getCookie("customerno"); if (customerno) { text += '
"; text += '
Continua ad acquistare
'; text += '
'; text += '
'; text += "
"; text += "
"; } text += '
'; if (customerno) { text += '
I prodotti più richiesti
'; } else { text += '
I prodotti più richiesti
'; } text += '
"; text += '
'; text += "
"; text += "
"; // text += '
' text += `
Think Big - Value Pack
${outputshimmer(text)}
Scopri tutti i prodottiPower Tools
${outputshimmer(text)}
Scopri l\' intera gammaProdotti nuovi
${outputshimmer(text)}
Esplora tutti i prodotti`; text += "
"; text += "
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += '
'; text += 'Priorità di evasione, consegna in 24/48 ore'; text += 'Oppure utilizza l\'opzione Click & Collect ordini online, ritiri la merce in 60 minuti al negozio più vicino'; text += "
"; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += '
'; text += 'Consegna gratuita per ordini sopra i 99€'; text += 'Altrimenti il costo della consegna verrà calcolato in base alle tue condizioni contrattuali'; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += 'Categorie in evidenza'; text += "
"; text += "
"; text += "
"; text += '
'; for (var k = 0; k < selectedCategories.length; k++) { if ( wuerthitaly_dateCheck( selectedCategories[k]["from"], selectedCategories[k]["to"] ) == "current" ) { text += '
'; text += '
'; text += '
'; text += ''; //text += ''; text += '' + selectedCategories[k]["title"] + ""; text += ''; text += ""; text += "
"; text += "
"; } } text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayProducts(divisione, segmento) { var selectedProducts = ""; if (divisione != "common_hp") { selectedProducts = wuerthitaly_filter_content( productsSettings, divisione, "divisione" ); } else { selectedProducts = getRandom(productsSettings, 12); } var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += 'La selezione dei prodotti più apprezzati
Su un catalogo di 130.000 prodotti'; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; for (var i = 0; i < selectedProducts.length; i++) { text += "
"; text += '
'; if ( wuerthitaly_dateCheck( selectedProducts[i]["from"], selectedProducts[i]["to"] ) == "current" ) { text += '
'; text += '
'; if (selectedProducts[i]["type"] == 0) { // è un prodotto text += '
'; text += ''; text += ''; text += '' + selectedProducts[i]["name"] + ""; if (selectedProducts[i]["desc"] != "") { text += '' + selectedProducts[i]["desc"] + ""; } // btn text += ""; text += ''; text += ''; text += 'nel carrello '; text += ""; text += ""; text += ""; } if (selectedProducts[i]["type"] == 1) { // è una famiglia prodotto text += '
'; // immagine text += ''; text += ''; text += '' + selectedProducts[i]["name"] + ""; if (selectedProducts[i]["desc"] != "") { text += '' + selectedProducts[i]["desc"] + ""; } text += ""; // btn /*text += ''; text += ''; text += ''; */ text += ''; text += ''; //text += ''; text += 'VAI ALLA CATEGORIA'; text += ""; text += ""; text += ""; } text += "
"; text += "
"; } text += "
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; var windowWidth = $(window).width(); if (windowWidth >= 1200) { wuerthitaly_activeSlider( ".all-product-gallery", true, 4, 1, false, false, 1500, true ); } else if (windowWidth >= 992) { wuerthitaly_activeSlider( ".all-product-gallery", true, 3, 1, false, false, 1500, true ); } else if (windowWidth >= 768) { wuerthitaly_activeSlider( ".all-product-gallery", true, 2, 1, false, false, 1500, true ); } else { wuerthitaly_activeSlider( ".all-product-gallery", true, 1, 1, false, false, 1500, true ); } text += '
'; text += '
'; text += 'Scopri tutti i prodotti Würth >'; text += ''; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayServices(divisione, segmento) { var selectedServices = wuerthitaly_filter_content( servicesSettings, divisione, "divisione" ); var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Servizi e strumenti di lavoro innovativi a tua disposizione
per migliorare i processi e la redditività del tuo business'; text += 'Servizi e strumenti di lavoro innovativi a tua disposizione per migliorare i processi e la redditività del tuo business'; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; if ($(document).width() > 992) { text += '
'; text += '
'; text += '
'; text += '
'; text += '' + selectedServices[0]["title"] + ""; for (k = 1; k < selectedServices.length; k++) { text += '' + selectedServices[k]["title"] + ""; } text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '' + selectedServices[0]["title"] + ""; text += '' + selectedServices[0]["description"] + ""; text += '' + selectedServices[0]["cta"] + ""; text += "
"; text += "
"; text += '
'; text += '
"; text += "
"; text += "
"; text += "
"; for (k = 1; k < selectedServices.length; k++) { text += '
'; text += '
'; text += '
'; text += '
'; text += '' + selectedServices[k]["title_b"] + ""; text += '' + selectedServices[k]["description"] + ""; text += '' + selectedServices[k]["cta"] + ""; text += "
"; text += "
"; text += '
'; text += '
"; text += "
"; text += "
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; } else { text += '
'; text += '
'; text += '
'; text += '
'; text += '' + selectedServices[0]["title"] + ""; for (k = 1; k < selectedServices.length; k++) { text += '' + selectedServices[k]["title"] + ""; } text += "
"; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '' + selectedServices[0]["title"] + ""; text += '' + selectedServices[0]["description"] + ""; text += '' + selectedServices[0]["cta"] + ""; text += "
"; text += '
'; text += '
"; text += "
"; text += "
"; text += "
"; for (k = 1; k < selectedServices.length; k++) { text += '
'; text += '
'; text += '
'; text += '' + selectedServices[k]["title"] + ""; text += '' + selectedServices[k]["description"] + ""; text += '' + selectedServices[k]["cta"] + ""; text += "
"; text += '
'; text += '
"; text += "
"; text += "
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayFerramentaOnline(divisione, segmento) { var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += 'WÜRTH: PRODOTTI E STRUMENTI
PER PROFESSIONISTI'; text += '
Il catalogo dei prodotti Würth consente ad artigiani, professionisti e aziende di trovare il materiale e i prodotti necessari al loro lavoro. Costantemente aggiornato, attualmente conta più di 130.000 articoli: gli utenti registrati all’Online-Shop possono visualizzare tutte le caratteristiche dei prodotti e il loro prezzo, come se si trovassero in una ferramenta online. Procedere con l’acquisto è facile: basta aggiungere al proprio carrello gli articoli nella quantità desiderata, quindi inviare il proprio ordine!
'; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += "
"; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayAppSection(divisione, segmento) { var text = ""; var titleBanner1 = "Il modo più semplice per ordinare online anche quando sei fuori sede!"; var subtitleBanner1 = "Promozioni, prodotti, documenti e tanto altro"; text += '
"; return text; } function wuerthitaly_hp_displayAppSectionMobile(divisione, segmento) { var text = ""; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += "
"; text += "
"; text += "
"; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Scarica la Würth App'; text += 'Il modo più semplice per ordinare
online anche quando sei fuori sede!'; text += 'Promozioni, prodotti, documenti e tanto altro'; text += "
"; text += "
"; text += "
"; var checkDevice = deviceOS(); if (checkDevice == "android") { text += '
"; } if ( checkDevice == "iphone" || checkDevice == "ipod" || checkDevice == "ipad" ) { text += '
"; } if ( checkDevice == "webos" || checkDevice == "windows phone" || checkDevice == "symbian" || checkDevice == "blackberry" || checkDevice == false ) { text += '
'; text += '
"; text += '
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayAcademySection(divisione, segmento) { var text = ""; text += '
'; text += '
'; text += '
'; text += 'CORSI / WEBINAR'; text += 'Würth Academy'; text += 'Visitando il portale Würth Academy potrai iscriverti e seguire corsi di aggiornamento WEBINAR di Azienda Digitale, ovunque tu sia, da qualsiasi dispositivo digitale.'; text += 'VISITA IL PORTALE PER SCOPRIRE I CORSI'; text += "
"; text += '
'; text += '
'; text += "
"; text += "
"; text += "
"; return text; } function wuerthitaly_hp_displayNewsletterSection(divisione, segmento) { var text = ""; text += '
'; text += WRenderNewsletter.print("classic", ""); text += "
"; text += ""; return text; } function wuerthitaly_hp_displayBlogSection(divisione, segmento) { var text = ""; /*text += '
'; text += '
'; text += '
'; text += '
'; text += 'Elementi di Fissaggio'; text += 'Viti per Legno'; text += 'Viti Autofilettanti'; text += 'Tasselli'; text += 'Rondelle'; text += 'Dadi'; text += 'Ganci'; text += 'Chiodi'; text += 'Rivetti'; text += '
'; text += '
'; text += '
'; text += '
'; text += ''; text += 'Antinfortunistica - Chimici'; text += ''; text += 'Dispositivi di Protezione Individuale'; text += 'Scarpe Antinfortunistica'; text += 'Cuffie Antirumore'; text += 'Guanti Antitaglio'; text += 'Sigillanti e Siliconi'; text += 'Disinfettanti'; text += 'Nastro Adesivo'; text += 'Stucco'; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Utensili'; text += 'Trapano Avvitatore a Batteria'; text += 'Smerigliatrice'; text += 'Cacciaviti'; text += 'Pinze'; text += 'Chiave a Bussola'; text += 'Spatole'; text += 'Badili'; text += 'Seghe'; text += '
'; text += '
'; text += '
'; text += '
'; text += 'Attrezzatura da Lavoro'; text += 'Allestimento Furgoni'; text += 'Strumenti di Misurazione'; text += 'Ferramenta per Mobili'; text += 'Tubi Idraulici'; text += 'Fascette'; text += 'Connettori Elettrici'; text += 'Trabattelli'; text += 'Banchi da Lavoro'; text += '
'; text += '
'; text += '
'; text += '
';*/ return text; } function wuerthitaly_hp_displaySeoAccordion(divisione, segmento) { var faq = [ /*{ "domanda": "Cosa significa Black Friday e perché accontentarsi solo di un venerdì?", "risposta": "Ormai da alcuni anni di tendenza anche in Italia, il Black Friday è il giorno dedicato allo shopping e agli sconti. Solitamente il Black Friday è l’ultimo venerdì di novembre, subito dopo la festa americana del Ringraziamento: ma perché farlo durare così poco? Würth colora di Black tutto il mese di novembre, scopri subito le promozioni!" }, { "domanda": "Quando inizia il Black Friday?", "risposta": "Con Würth il Black Friday dura più a lungo (come i nostri prodotti!). Non ci bastava solo un giorno per regalarti prezzi shock e omaggi incredibili, quindi ti aspettiamo per le Black Week dal 16 al 30 novembre. Non ti basta? Scopri l’anteprima Online già oggi!" }, { "domanda": "Black Week 2020: fino a quando dura?", "risposta": "Hai tempo fino al 30 novembre per approfittare della Black Week: online, in negozio e con il tuo venditore. Il Black Friday di Würth dura tutto novembre!" }, { "domanda": "Come funziona la Black Week Würth?", "risposta": "Per approfittare del Black Friday ti basta contattare il tuo venditore, andare nel tuo negozio Würth preferito o sfogliare le nostre promo online! La Black Week è ovunque e dura fino al 30 novembre!" }, { "domanda": "Black Friday: cosa comprare su Würth Italia? Su quali prodotti ci sono gli sconti migliori?", "risposta": "Per la Black Week 2020 abbiamo selezionato prodotti e omaggi esclusivi, oltre a darti fino al 15% di sconto sui prodotti scelti da te! E se ancora non ti basta, il carrello Black Week è in edizione limitata con un prezzo SHOCK!" },*/ { domanda: "Elementi di Fissaggio e Ferramenta per Mobili e Serramenti", risposta: 'Würth si è affermata in tutto il mondo come distributore di prodotti e sistemi di fissaggio professionali. Nel settore della viteria è forte di una gamma completa, che consente di utilizzare gli elementi più adatti e performanti a seconda delle tipologie di lavorazione. Un prodotto esclusivo sono le nostre viti per legno ASSY®, che continuiamo a perfezionare nel corso degli anni.
Un’altra gamma di elementi di fissaggio che è possibile acquistare online è quella dei tasselli e ancoranti, che comprendono una varietà di prodotti adatti a soddisfare ogni necessità. Non mancano poi elementi di bloccaggio e di giunzione, come dadi, rondelle, rivetti. È disponibile anche una serie di articoli di ferramenta per mobili e serramenti.', }, { domanda: "Antinfortunistica e Prodotti Chimici", risposta: 'La fornitura di materiale di lavoro si completa con una serie di articoli che servono a garantire la protezione del lavoratore dai rischi connessi alla sua mansione. Previsti dalle normative di legge atte a tutelare la sicurezza dei lavoratori nei luoghi di lavoro, i dispositivi di protezione individuale si possono ordinare direttamente online e fornire al proprio personale grazie ai nostri distributori automatizzati di DPI. All’interno del nostro catalogo abbiamo inserito dei modelli innovativi di scarpe antinfortunistica e da lavoro.
Il nostro assortimento di articoli comprende anche prodotti chimici, come additivi, primer, vernici e vari tipi di silicone e sigillante per un utilizzo professionale.', }, { domanda: "Utensili e Attrezzatura da Lavoro", risposta: 'Mettiamo a disposizione di artigiani e aziende un ampio assortimento di utensili professionali sia manuali che elettrici, a batteria e pneumatici: si possono acquistare online cacciaviti e inserti, chiavi resistenti e adatte a ogni tipo di lavorazione e chiavi a bussola complete di appositi accessori. Ma anche martelli e utensili a percussione, pinze e tenaglie di varie dimensioni, strumenti di lavoro per la gessatura e l\'asportazione di materiale, trapani, tassellatori, smerigliatrici, saldatrici.
Forniamo anche luci da lavoro a led, cassette portautensili e materiali di imballaggio e per la pulizia di laboratori, officine e magazzini.
Würth ha scelto di operare determinando sei divisioni di mercato, per ognuna delle quali propone una selezione di attrezzatura da lavoro specifica. Consulta le nostre pagine divisionali:
- attrezzi per edilizia e costruzioni
- attrezzi e ferramenta per legno
- attrezzi per officina meccanica auto
- attrezzi per elettricisti e idraulici
- attrezzi per lavorazione metallo
- attrezzi per camion e veicoli industriali
', }, ]; var text = ""; text += '
'; /*text += '
'; text += '
'; text += '
'; text += 'Domande frequenti sul Black Friday e sulla Black Week 2020 Würth'; text += '
'; text += '
'; text += '
';*/ text += '
'; text += '
'; text += '
'; text += '
'; for (var j = 0; j < faq.length; j++) { if (j == 0) { text += '
'; text += '
'; text += '
'; text += ''; text += '' + faq[j]["domanda"] + ""; text += ''; text += ""; text += "
"; text += "
"; text += '
'; text += '
'; text += faq[j]["risposta"]; text += "
"; text += "
"; text += "
"; } else { text += '
'; text += '
'; text += '
'; text += ''; text += '' + faq[j]["domanda"] + ""; text += ''; text += ""; text += "
"; text += "
"; text += '
'; text += '
'; text += faq[j]["risposta"]; text += "
"; text += "
"; text += "
"; } } text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; return text; } function wuerth_italia_wp_colonne_per_riga(elementi_totali, elemento) { // se % 3 === 0 allora tutti al 33% ( 6, 3 ) // se % 2 === 0 allora tutti al 50% ( 4, 2 ) // se > 3 una riga al 33% ( 5 ) // altrimenti uno al 100% ( 1 ) if (elementi_totali % 3 === 0) { return "4"; } if (elementi_totali % 2 === 0) { return "6"; } if (elementi_totali === 5) { if (elemento < 3) { return "4"; } else { return "6"; } } return "12"; } function getRandom(arr, n) { var result = new Array(n), len = arr.length, taken = new Array(len); if (n > len) throw new RangeError("getRandom: more elements taken than available"); while (n--) { var x = Math.floor(Math.random() * len); result[n] = arr[x in taken ? taken[x] : x]; taken[x] = --len in taken ? taken[len] : len; } return result; } $(window).on("resize scroll", function () { var homepage_custom = wuerthitaly_getCookie("homepage_custom"); var init_setting = wuerthitaly_filter_content( settingsHomepages, homepage_custom, "divisione" ); //console.log(init_setting); var selectedBlogs = ""; if (init_setting.length > 0) { selectedBlogs = init_setting; } else { var globalHpSsettings = { blog: "863,882,881,67,880,263,883,472", rendering: [ //"appSectionMobile", "slider", //"feed_BW", //"hpExperience", "categorie", "prodotti", "ferramentaOnline", "servizi", "appSection", "seoAccordion", "academySection", "newsletterSection", "blogSection", ], }; selectedBlogs = globalHpSsettings; } //console.log(selectedBlogs); var elementTop = $("#newsletterSection").offset().top; var elementBottom = elementTop + $("#newsletterSection").outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); if (elementBottom > viewportTop && elementTop < viewportBottom) { if ($("#blogSection").length) { } else { var text = ""; text += '
'; text += '
'; text += '
'; text += 'Le ultime news dal mondo Würth'; text += ''; text += "
"; text += "
"; text += '
'; text += "
"; text += '
'; text += '
'; text += 'Leggi tutti gli articoli su Würth News'; text += ''; text += "
"; text += "
"; text += "
'; const dateCheckPrefooter = wuerthitaly_dateCheck( "29/07/2024/0/0/0/000", "30/09/2024/23/59/59/999" ); if (dateCheckPrefooter === "current") { text += '
'; } else if (dateCheckPrefooter === "after") { text += '
'; } text += "
"; $(text).insertAfter("#newsletterSection"); initBlogNews(selectedBlogs["blog"]); } } }); function initBlogNews(cat) { var filtro = cat; $.ajax({ url: "https://news.wuerth.it/feed/json?callback=callback&cat=" + filtro + "", dataType: "jsonp", jsonpCallback: "handleData", success: function (data) { //console.log('success'); }, error: function (data) { //console.log('error'); }, }); } function handleData(data) { var text = ""; var i = 0; if (data.length > 0) { var _$$slick; text += '
'; text += '
'; for (i = 0; i < data.length; i++) { if (i <= 7) { text += '
'; var pubblicato = new Date(data[i]["date"]); text += '
'; text += ''; text += '
'; text += 'del ' + pubblicato.toLocaleDateString() + ""; text += '' + data[i]["title"] + ' > leggi l\'articolo'; //text += 'Leggi l\'articolo '; text += "
"; text += "
"; text += "
"; } } text += "
"; text += "
"; $(text).appendTo("#blog"); $("#blog-slider").slick( ((_$$slick = { centerMode: true, slidesToScroll: 3, autoplay: true, autoplaySpeed: 5000, }), _defineProperty(_$$slick, "centerMode", true), _defineProperty(_$$slick, "centerPadding", "20px"), _defineProperty(_$$slick, "slidesToShow", 3), _defineProperty(_$$slick, "responsive", [ { breakpoint: 1280, settings: { centerMode: true, centerPadding: "100px", slidesToShow: 2, slidesToScroll: 2, }, }, { breakpoint: 1024, settings: { centerMode: true, centerPadding: "100px", slidesToShow: 2, slidesToScroll: 2, }, }, { breakpoint: 768, settings: { centerMode: true, centerPadding: "20px", slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 480, settings: { centerMode: true, centerPadding: "20px", slidesToShow: 1, slidesToScroll: 1, }, }, ]), _$$slick) ); } } function redirectBlog() { window.open("https://news.wuerth.it"); } function deviceOS() { var useragent = navigator.userAgent; if (useragent.match(/Android/i)) { return "android"; } else if (useragent.match(/webOS/i)) { return "webos"; } else if (useragent.match(/iPhone/i)) { return "iphone"; } else if (useragent.match(/iPod/i)) { return "ipod"; } else if (useragent.match(/iPad/i)) { return "ipad"; } else if (useragent.match(/Windows Phone/i)) { return "windows phone"; } else if (useragent.match(/SymbianOS/i)) { return "symbian"; } else if (useragent.match(/RIM/i) || useragent.match(/BB/i)) { return "blackberry"; } else { return false; } } /* function sticky_relocate_mobile() { var window_top = $(window).scrollTop(); var footer_top = $("#legalContent").offset().top; var div_top = $('.aside-anchor').offset().top; var div_height_left = $('#menuMobilePromo').height(); var padding = 0; // tweak here or get from margins etc if ((window_top + div_height_left > footer_top - padding)) { $('#menuMobilePromo').removeClass('stickMobile'); $('#menuMobilePromo').removeClass('w-100 bg-black padding-y-200'); } else if (window_top > div_top) { $('#menuMobilePromo').addClass('stickMobile'); $('#menuMobilePromo').addClass('w-100 bg-black padding-y-200'); } else { $('#menuMobilePromo').removeClass('stickMobile'); $('#menuMobilePromo').removeClass('w-100 bg-black padding-y-200'); } } $(function () { if($(document).width()<992){ $(window).scroll(sticky_relocate_mobile); sticky_relocate_mobile(); }else{ $(window).scroll(sticky_relocate); sticky_relocate(); } });*/ const categoryTemplate = (e) => { const { DESCRIPTION, IMAGEURL, RANKING, LEVEL4ID, QTY_PRODLEVEL4 = "12556", } = e; //console.log(DESCRIPTION,IMAGEURL,RANKING,LEVEL4ID) const removeSkuParenthesis = (e) => e.replace(/\((?=.*\d)[^()]*\)/g, ""); const CleanTitle = removeSkuParenthesis(DESCRIPTION); const img = `
`; const title = `
${CleanTitle}
`; const numberOfProducts = QTY_PRODLEVEL4 ? `
${QTY_PRODLEVEL4} prodotti
` : ``; const visitingURL = `https://eshop.wuerth.it/Categorie-di-prodotti/-/3114${LEVEL4ID}.cyid/3114.cgid/it/IT/EUR/#CampaignName=HPSU_${LEVEL4ID.replace( " ", "_" )}_${RANKING}`; return `
${img} ${title} ${numberOfProducts}`; }; let SlickOption = { dots: true, infinite: false, speed: 300, slidesToShow: 6, slidesToScroll: 4, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true, dots: true, }, }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2, }, }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, ], }; function getRelatedPoductsBES() { var customerNo = ""; if ($("#shopCustomerNo").length > 0) { customerNo = $("#shopCustomerNo").html(); } $.ajax({ url: "https://www.wuerth.it/php-scripts/eShop/product-suggestion/?vn=HPCAT", dataType: "jsonp", success: function (response) { if (response.length > 0) { response.sort((a, b) => a.RANKING - b.RANKING); const t = document.querySelector(".widgetprodotti-BES"); //console.log("responmse",t) t.innerHTML = response.map((e) => categoryTemplate(e)).join(""); $(t).slick(SlickOption); } }, }); } function displayRelatedProductsBES(data) { // return displayRelatedProducts(data, 'BES') } function initSlider(element) { let dotsClass = element.find(".card-product").length > 8 ? "slick-dots slick-xs-line" : "slick-dots"; //console.log(element.find('.card-product') ); element.slick({ dots: true, infinite: true, autoplay: false, autoplaySpeed: 2000, speed: 300, slidesToShow: 6, slidesToScroll: 6, dotsClass: dotsClass, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 4, slidesToScroll: 4, }, }, { breakpoint: 992, settings: { slidesToShow: 3, slidesToScroll: 3, }, }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 2, }, }, { breakpoint: 576, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, ], }); } function getRelatedProductsCHR(customerno) { $.ajax({ url: "https://www.wuerth.it/php-scripts/eShop/product-suggestion/", dataType: "jsonp", data: { op: "c", customerno: customerno, cid: "WWP_CHR", }, type: "GET", success: renderProductsCHR, }); } function fillproductsCHR(customerno, data) { $.ajax({ url: "https://www.wuerth.it/php-scripts/eShop/product-suggestion/?op=c&customerno=" + customerno + "&cid=WWP_BES_V2", type: "GET", dataType: "jsonp", success: function (data2) { //console.log(data2) let partial = data2.slice(0, 12 - data.length); const products = [...data, ...partial]; renderProductsCHR(products); }, }); } function getRelatedProductsCHRV2(customerno) { $.ajax({ url: "https://www.wuerth.it/php-scripts/eShop/product-suggestion/", dataType: "jsonp", data: { op: "c", customerno: customerno, cid: "WWP_CHR_V2", }, type: "GET", success: function (data) { if (!data) { getRelatedProductsCHR(customerno); } else { data = data.sort(function (a, b) { return a.PRODUCT_RANK - b.PRODUCT_RANK; }); //console.log("DATAAAAA:::::",data) if (data.length < 12) { //console.log(data) fillproductsCHR(customerno, data); } else { renderProductsCHR(data); } } }, }); } function renderProductsCHR(data) { data = data.map(function (item) { return Object.assign(item, { DSC_PRODUCT: item.PRODUCTNO, DSC_PACKAGESIZE: item.PACKAGE_SIZE, }); }); displayRelatedProducts(data, "CHR"); initSlider($("#relatedProductsWuerthIT-CHR")); } function displayRelatedProducts(data, container) { //console.log('widget'); var trackingCodes = { CHR: "WWP_CHR_HP_", BES: "HPSU_", }; var piwikCategoryItems = { CHR: "WidgetWelcomePage", BES: "WidgetHomePage", }; var text = ""; text += '
'; text += '
'; //text += 'I più richiesti'; text += '
'; text += '
'; for (var key in data) { var prodotto = data[key]; if (!prodotto["IMAGETHUMBNAILURL"] || !prodotto["LONGDESCRIPTION"]) { return; } var tracking = trackingCodes[container] + cleanStr(prodotto["DSC_PRODUCT"]) + "_" + prodotto["PRODUCT_RANK"]; var productUrl = "https://eshop.wuerth.it/-/" + cleanStr(prodotto["DSC_PRODUCT"].replace(/\s/g, "%20")) + ".sku/it/IT/EUR/#CampaignName=" + tracking + ""; text += '
'; text += '
'; text += '
'; text += '
'; text += '
'; if (prodotto["IMAGETHUMBNAILURL"] != null) { text += '"; //text += ''; text += ""; } else { text += ''; //text += ''; text += ""; } text += '
'; text += ""; text += ''; text += '' + prodotto["LONGDESCRIPTION"].truncate(45, true) + ""; text += ""; text += "
"; text += '
"; text += "
"; text += "
"; text += "
"; text += "
"; text += "
"; } text += "
"; text += "
"; text += "
"; text += "
"; $("#shimmerwrapper-" + container).remove(); $(".widgetprodotti-" + container).append(text); } String.prototype.truncate = String.prototype.truncate || function (n, useWordBoundary) { if (this.length <= n) { return this; } let subString = this.slice(0, n - 1); // the original check subString = subString.charAt(0).toUpperCase() + subString.slice(1); return ( (useWordBoundary ? subString.slice(0, subString.lastIndexOf(" ")) : subString) + "…" ); }; function sendToPiwik(i, string) { //console.log(i); _paq.push(["trackEvent", string, i]); } function cleanStr(str) { while (str.indexOf("\t") > -1) { str = str.replace("\t", ""); } /*while (str.indexOf(" ") > -1) { str = str.replace(" ", ""); }*/ return str; } //funzioni widget & shimmer async function call4data(json, category, isDisabled = false) { return new Promise((resolve, reject) => { //console.log('CATCAT',category); let url, callback; let retrievedData = []; if (isDisabled) { resolve({ isFallback: true }); } json.forEach((element, index) => { // console.log(json,index ) if (category === "outlet" || category === "pwrtool" || category === "thinkbig") { //console.log('CATTTTTTTTTT',category); url = "https://wos.wuerth.it/landing_page_admin/public/page/" + element + "/json"; callback = "wuerthitaly_displayLpGenerator"; } else { url = "https://www.wuerth.it/php-scripts/eShop/product-suggestion/?op=np&"; callback = "landinglp"; } function getData (e) { //console.log("getData",e) return e }; $.ajax({ url: url, type: "GET", dataType: "jsonp", callback: 'getData', success: function (data) { //console.log("getData",data) let items; if (category === "newprod") { items = data; } else { items = data.items; } items.forEach((item) => { retrievedData.push(item); }); }, error: function (error) { reject(error); }, complete: function () { if (index === json.length - 1) { // console.log("retrievedata",retrievedData) resolve(retrievedData); } }, }); }); }); } function randomSetIntFromInterval(min, max, setlength) { // min and max included let set = []; return Array.from(set); for (let s = new Set(); s.size <= setlength - 1; set = s) { s.add(Math.floor(Math.random() * (max - min + 1) + min)); } return Array.from(set); } function populateCategoryWidget(data, category) { //console.log('CHE CAT SONO?',category) let text = ""; if (data?.isFallback) { $("#" + category + "_col > .package_shimmer").remove(); $("#" + category + "_col").append(fallBackFiller()); return; } data.forEach((element) => { //console.log('CAT',element); if (category === "outlet") { var { sku, name, description, img, url, packingunit, price1: price, price_old: oldprice, } = element; const tracking = url; var productUrl = url; // img = (img.endsWith('jpg')?img:'/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/_products/imgs/product_image.jpg') } else if (category === "newprod") { var { DSC_PRODUCT: sku, SUGGESTION_RANK: rank, LONGDESCRIPTION: name, DESCRIPTION: description, IMAGETHUMBNAILURL: img, LEVEL5ID: lvl5id, ESHOPMKLEVEL5: mk5id, SUGGESTION_TYPE: suggestiontype, } = element; if (name === null) { name = element["DESCRIPTION"]; } if (suggestiontype == "product") { var tracking = "NEPRHP_" + cleanStr(sku.trim()) + "_" + rank; } else { var tracking = "NEPRHP_" + cleanStr(lvl5id.trim()) + "_" + rank; } if (suggestiontype == "product") { var productUrl = "https://eshop.wuerth.it/-/" + cleanStr(sku.replace(/\s/g, "%20")) + ".sku/it/IT/EUR/#CampaignName=" + tracking + ""; } else { var productUrl = "https://eshop.wuerth.it/-/-/3114" + cleanStr(mk5id.replace(/\s/g, "%20")) + ".cyid/3114.cgid/it/IT/EUR/#CampaignName=" + tracking + ""; } /* var tracking = 'NEPRHP_' + cleanStr(sku.replace(/\s/g, '')) + '_' + rank; var productUrl = 'https://eshop.wuerth.it/-/' + cleanStr(sku.replace(/\s/g, '') ) + '.sku/it/IT/EUR/#CampaignName=' + tracking + ''; */ img = img !== null ? img : "/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/_products/imgs/product_image.jpg"; } else if (category === "pwrtool") { var { sku, name, description, img, url, packingunit, price: price, } = element; const tracking = url; var productUrl = url; // img = (img.endsWith('jpg')?img:'/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/_products/imgs/product_image.jpg') } else if (category === "thinkbig") { //console.log('ENTROTHINKBIG',prezzo); var { sku, name, description, img, url, packingunit, prezzo, } = element; const tracking = url; var productUrl = "https://eshop.wuerth.it/-/" + cleanStr(sku.replace(/\s/g, "%20")) +".sku/it/IT/EUR/"; } img = img.endsWith("jpg") ? img : "/is-bin/intershop.static/WFS/WuerthGroup-Wuerth-Site/3114-B1/en_US/_products/imgs/product_image.jpg"; text += '
'; text += '
'; if (img != null) { text += '"; text += category === "outlet" ? 'PREZZOOUTLET %' : ""; //text += ''; text += ""; } else { text += ''; //text += ''; text += ""; } text += '
'; //price block text += '
'; if (oldprice) { text += '' + oldprice + "€"; } if (price) { text += '' + price + (category === "pwrtool" ? ",00" : "") + "€"; }else{ text += ''; } if(category==='thinkbig'){ text += ''+ prezzo.replace('.',',') +'€'; } text += "
"; text += ""; text += '
' + name.truncate(50, true) + "
"; text += ''; // text += '' + description.truncate(60,true) + ''; text += ""; text += "
"; text += '
"; text += "
"; text += "
"; }); $("#" + category + "_col > .package_shimmer").remove(); $("#" + category + "_col").append(text); $("#" + category + "_col").slick({ infinite: true, autoplay: false, autoplaySpeed: 2000, speed: 300, slidesToShow: 1, slidesToScroll: 1, dots: true, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 992, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 576, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, ], }); } function outputshimmer() { return `
`; } // ]]>