{"product_id":"tenda-plissettata-su-misura","title":"Tenda Plissettata su Misura","description":"\u003cdiv id=\"plisse-fix\" style=\"font-family:system-ui,sans-serif;max-width:950px;margin:20px auto;padding:20px;background:#fff;color:#111;border:1px solid #e5e7eb;border-radius:16px\"\u003e\n\u003cstyle\u003e\n#plisse-fix *{box-sizing:border-box}\n.pl-card{border:1.5px solid #e5e7eb;border-radius:14px;padding:10px;cursor:pointer;background:#fff;transition:.15s}\n.pl-card:hover{border-color:#999}\n.pl-card.selected{border-color:#111;box-shadow:0 0 0 2px #111;background:#f9fafb}\n.pl-grid{display:grid;gap:10px}\n.pl-grid-4{grid-template-columns:repeat(4,1fr)}\n.pl-grid-2{grid-template-columns:1fr 1fr}\n.pl-input{width:100%;height:44px;border:1.5px solid #e5e7eb;border-radius:10px;padding:0 14px;font-size:15px}\n.pl-price{background:#ffffff;color:#111;border:2px solid #111;border-radius:16px;padding:16px;margin-top:24px}\n.pl-btn{width:100%;height:48px;border-radius:12px;border:0;background:#111;color:#fff;font-weight:700;cursor:pointer;margin-top:12px}\n.window-frame{width:100%;height:90px;background:#f1f5f9;border:2px solid #cbd5e1;border-radius:6px;padding:4px;position:relative;overflow:hidden}\n.window-glass{width:100%;height:100%;background:linear-gradient(135deg,#e0f2fe 0%,#bae6fd 50%,#e0f2fe 100%);border-radius:3px;position:relative;overflow:hidden}\n.plisse-blind{position:absolute;top:8px;left:6px;right:6px;height:58%;border-radius:2px;box-shadow:0 1px 3px rgba(0,0,0,.2)}\n.plisse-pleats{width:100%;height:100%;background:repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0px, rgba(0,0,0,.08) 1px, transparent 1px, transparent 6px)}\n.window-handle{position:absolute;bottom:6px;right:8px;width:3px;height:12px;background:#64748b;border-radius:2px}\n@media(max-width:700px){.pl-grid-4{grid-template-columns:repeat(2,1fr)}.pl-grid-2{grid-template-columns:1fr}}\n\/* Nasconde solo i bottoni originali di Shopify per non avere doppi bottoni - non tocca la struttura del configuratore *\/\n.product-form, .shopify-payment-button { display:none !important; }\n\u003c\/style\u003e\n\n\u003ch2 style=\"margin:0 0 6px;font-size:22px\"\u003eTenda Plissettata su Misura - 16 Finestre Reali\u003c\/h2\u003e\n\u003cdiv style=\"background:#111;color:#fff;padding:6px 12px;border-radius:20px;display:inline-block;font-size:11px;font-weight:700;margin-bottom:12px\"\u003e✓ 16 FINESTRE REALI - VEDI COLORE SU FINESTRA\u003c\/div\u003e\n\u003cp style=\"font-size:12px;color:#71717a;margin:0 0 18px\"\u003eCalcolo al mm - Euro - Anteprima reale\u003c\/p\u003e\n\n\u003cdiv style=\"margin-bottom:20px\"\u003e\n\u003ch3 style=\"font-size:13px;font-weight:700;margin:0 0 8px\"\u003e1. Tipo montaggio\u003c\/h3\u003e\n\u003cdiv class=\"pl-grid pl-grid-4\" id=\"mont-grid\"\u003e\u003c\/div\u003e\n\u003cdiv id=\"mont-info\" style=\"margin-top:8px;padding:10px;background:#f6f6f7;border-radius:10px;font-size:11px\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cdiv style=\"margin-bottom:20px\"\u003e\n\u003ch3 style=\"font-size:13px;font-weight:700;margin:0 0 8px\"\u003e2. Misure (cm)\u003c\/h3\u003e\n\u003cdiv class=\"pl-grid pl-grid-2\"\u003e\n\u003cdiv\u003e\n\u003clabel style=\"font-size:11px;font-weight:600\"\u003eLarghezza\u003c\/label\u003e\u003cinput id=\"larg\" class=\"pl-input\" type=\"number\" step=\"0.1\" value=\"80\"\u003e\u003cdiv id=\"larg-mm\" style=\"font-size:10px;color:#888;margin-top:3px\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv\u003e\n\u003clabel style=\"font-size:11px;font-weight:600\"\u003eAltezza\u003c\/label\u003e\u003cinput id=\"alt\" class=\"pl-input\" type=\"number\" step=\"0.1\" value=\"120\"\u003e\u003cdiv id=\"alt-mm\" style=\"font-size:10px;color:#888;margin-top:3px\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cdiv style=\"margin-bottom:20px\"\u003e\n\u003ch3 style=\"font-size:13px;font-weight:700;margin:0 0 8px\"\u003e3. Tessuto - 16 finestre con colore reale\u003c\/h3\u003e\n\u003cdiv class=\"pl-grid pl-grid-4\" id=\"tess-grid\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cdiv style=\"margin-bottom:20px\"\u003e\n\u003ch3 style=\"font-size:13px;font-weight:700;margin:0 0 8px\"\u003e4. Colore profilo - 7 colori\u003c\/h3\u003e\n\u003cdiv class=\"pl-grid\" style=\"grid-template-columns:repeat(auto-fill,minmax(150px,1fr))\" id=\"prof-grid\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cdiv class=\"pl-price\" id=\"price-box\"\u003e\u003c\/div\u003e\n\u003cdiv id=\"plisse-msg\" style=\"text-align:center;margin-top:10px;font-size:13px\"\u003e\u003c\/div\u003e\n\n\u003cscript\u003e\n(function(){\nconst montaggi=[\n{id:'invasivo',nome:'Con viti',desc:'Foratura min 10mm',extra:0},\n{id:'non-invasivo',nome:'Senza fori',desc:'Gancetti 13-20mm',extra:4},\n{id:'fix',nome:'FIX',desc:'Adesivo',extra:6}\n];\nconst tessuti=[\n{name:'Bialy',it:'Bianco',hex:'#FFFFFF',prezzo:45},\n{name:'Alabaster',it:'Alabastro',hex:'#F5F1E8',prezzo:45},\n{name:'Magnolia',it:'Magnolia',hex:'#F2E8D5',prezzo:45},\n{name:'Wanilia',it:'Vaniglia',hex:'#F6E9B8',prezzo:45},\n{name:'Mieta',it:'Verde Salvia',hex:'#7A9E7E',prezzo:55},\n{name:'Rossi',it:'Rosa Cipria',hex:'#F4C2C2',prezzo:55},\n{name:'Lazur',it:'Turchese',hex:'#5BC0BE',prezzo:55},\n{name:'Sliwka',it:'Prugna',hex:'#5D2A42',prezzo:55},\n{name:'Mandarynka',it:'Arancio',hex:'#E67E22',prezzo:55},\n{name:'Kakao',it:'Tortora',hex:'#C4A484',prezzo:55},\n{name:'Muszkat',it:'Marrone Chiaro',hex:'#8B6F47',prezzo:55},\n{name:'Wenge',it:'Cioccolato',hex:'#3E2723',prezzo:65},\n{name:'Czarny',it:'Nero',hex:'#111111',prezzo:65},\n{name:'Popiel',it:'Grigio Chiaro',hex:'#E0E0E0',prezzo:45},\n{name:'Stalowy',it:'Grigio Acciaio',hex:'#9E9E9E',prezzo:45},\n{name:'Marengo',it:'Grafite',hex:'#424242',prezzo:45}\n];\nconst profili=[\n{name:'Bianco 9016',extra:0},\n{name:'Marrone 8017',extra:0},\n{name:'Antracite 7016',extra:0},\n{name:'Anodizzato Argento',extra:0},\n{name:'Nero 9005',extra:0},\n{name:'Rovere Dorato',extra:5},\n{name:'Noce',extra:5}\n];\nlet selMont='non-invasivo';\nlet selTess=tessuti[0];\nlet selProf=profili[0];\nlet qty=1;\n\nfunction windowHTML(hex){\n  return '\u003cdiv class=\"window-frame\"\u003e\u003cdiv class=\"window-glass\"\u003e\u003cdiv class=\"plisse-blind\" style=\"background:'+hex+';\"\u003e\u003cdiv class=\"plisse-pleats\"\u003e\u003c\/div\u003e\u003c\/div\u003e\u003cdiv class=\"window-handle\"\u003e\u003c\/div\u003e\u003c\/div\u003e\u003c\/div\u003e';\n}\n\nfunction renderMont(){\n  var g=document.getElementById('mont-grid');\n  g.innerHTML='';\n  montaggi.forEach(function(m){\n    var d=document.createElement('div');\n    d.className='pl-card'+(selMont===m.id?' selected':'');\n    d.innerHTML='\u003cdiv style=\"font-size:12px;font-weight:700\"\u003e'+m.nome+'\u003c\/div\u003e\u003cdiv style=\"font-size:10px;color:#666\"\u003e'+m.desc+' +'+m.extra+'€\u003c\/div\u003e';\n    d.addEventListener('click', function(){ selMont=m.id; renderAll(); });\n    g.appendChild(d);\n  });\n  var info=document.getElementById('mont-info');\n  if(selMont==='invasivo') info.textContent='Con viti: Larghezza = vetro + 1 guarnizione, Altezza = vetro + 2 guarnizioni, min 10mm';\n  else if(selMont==='non-invasivo') info.textContent='Senza fori: Larghezza = vetro + guarnizioni + 2-4cm, Altezza = anta intera, telaio 13-20mm';\n  else info.textContent='FIX adesivo: su superficie liscia, finestre fisse';\n}\n\nfunction renderTess(){\n  var g=document.getElementById('tess-grid');\n  g.innerHTML='';\n  tessuti.forEach(function(t){\n    var d=document.createElement('div');\n    d.className='pl-card'+(selTess.name===t.name?' selected':'');\n    d.innerHTML=windowHTML(t.hex)+'\u003cdiv style=\"font-size:11px;font-weight:700;text-align:center;margin-top:6px\"\u003e'+t.it+'\u003cbr\u003e\u003cspan style=\"font-weight:400;color:#888;font-size:9px\"\u003e'+t.name+'\u003c\/span\u003e\u003c\/div\u003e';\n    d.addEventListener('click', function(){ selTess=t; renderAll(); });\n    g.appendChild(d);\n  });\n}\n\nfunction renderProf(){\n  var g=document.getElementById('prof-grid');\n  g.innerHTML='';\n  profili.forEach(function(p){\n    var d=document.createElement('div');\n    d.className='pl-card'+(selProf.name===p.name?' selected':'');\n    d.innerHTML='\u003cdiv style=\"font-size:11px;font-weight:600\"\u003e'+p.name+'\u003c\/div\u003e\u003cdiv style=\"font-size:10px;color:#888\"\u003e'+(p.extra?'+'+p.extra+'€':'')+'\u003c\/div\u003e';\n    d.addEventListener('click', function(){ selProf=p; renderAll(); });\n    g.appendChild(d);\n  });\n}\n\nfunction calc(){\n  var larg=parseFloat(document.getElementById('larg').value)||0;\n  var alt=parseFloat(document.getElementById('alt').value)||0;\n  var lm=Math.round(larg*10);\n  var am=Math.round(alt*10);\n  document.getElementById('larg-mm').textContent=larg?'Tessuto: '+lm+'mm':'';\n  document.getElementById('alt-mm').textContent=alt?'Tessuto: '+am+'mm':'';\n  var m2=(lm*am)\/1000000;\n  var base=m2*selTess.prezzo*1.15;\n  var montExtra=montaggi.find(function(x){return x.id===selMont;}).extra;\n  var tot=base+9+montExtra+selProf.extra;\n  if(tot\u003c22) tot=22;\n  return {tot:tot,lm:lm,am:am,m2:m2,larg:larg,alt:alt};\n}\n\nfunction renderPrice(){\n  var c=calc();\n  var tot=c.tot;\n  var sconto=0,next=0,nextLabel='';\n  var totalQty=tot*qty;\n  if(totalQty\u003e=200) sconto=5;\n  else if(totalQty\u003e=150){sconto=5; next=200-totalQty; nextLabel='spedizione gratuita';}\n  else if(totalQty\u003e=80){sconto=4; next=150-totalQty; nextLabel='-5%';}\n  else if(totalQty\u003e=50){sconto=3; next=80-totalQty; nextLabel='-4%';}\n  else {next=50-totalQty; nextLabel='-3%';}\n  var totScont=totalQty*(1-sconto\/100);\n  var perc=Math.min(100,(totalQty\/200)*100);\n  var html='';\n  html+='\u003cdiv style=\"font-size:10px;opacity:.8\"\u003e'+selTess.it+' - '+c.lm+'x'+c.am+'mm - '+selProf.name+' ('+c.m2.toFixed(3)+'m²)\u003c\/div\u003e';\n  html+='\u003cdiv style=\"display:flex;justify-content:space-between;align-items:center;margin-top:8px\"\u003e';\n  html+='\u003cdiv\u003e\u003cbutton id=\"btn-minus\" style=\"width:28px;height:28px;border-radius:50%;border:1px solid #111;background:transparent;color:#111;cursor:pointer\"\u003e-\u003c\/button\u003e \u003cspan style=\"margin:0 8px;font-weight:700\"\u003e'+qty+'\u003c\/span\u003e \u003cbutton id=\"btn-plus\" style=\"width:28px;height:28px;border-radius:50%;border:1px solid #111;background:transparent;color:#111;cursor:pointer\"\u003e+\u003c\/button\u003e\u003c\/div\u003e';\n  html+='\u003cdiv style=\"text-align:right\"\u003e\u003cdiv style=\"font-size:10px;opacity:.7\"\u003eUnitario\u003c\/div\u003e\u003cdiv style=\"font-weight:700\"\u003e'+tot.toFixed(2)+'€\u003c\/div\u003e\u003c\/div\u003e\u003c\/div\u003e';\n  html+='\u003cdiv style=\"height:5px;background:#e5e7eb;border-radius:99px;margin:8px 0\"\u003e\u003cdiv style=\"height:100%;background:#111;width:'+perc+'%;border-radius:99px\"\u003e\u003c\/div\u003e\u003c\/div\u003e';\n  html+='\u003cdiv style=\"font-size:10px;opacity:.8\"\u003e'+(next\u003e0?'Mancano '+next.toFixed(2)+'€ per '+nextLabel:'Sbloccato -'+sconto+'%'+(totalQty\u003e=200?' + spedizione gratis':''))+'\u003c\/div\u003e';\n  html+='\u003cdiv style=\"margin-top:10px\"\u003e\u003cdiv style=\"font-size:10px;opacity:.7\"\u003eTotale '+(sconto?'(-'+sconto+'%)':'')+'\u003c\/div\u003e\u003cdiv style=\"font-size:20px;font-weight:800\"\u003e'+totScont.toFixed(2)+'€\u003c\/div\u003e\u003c\/div\u003e';\n  html+='\u003cbutton id=\"btn-cart\" class=\"pl-btn\"\u003eAggiungi al carrello - '+totScont.toFixed(2)+'€\u003c\/button\u003e';\n  document.getElementById('price-box').innerHTML=html;\n  document.getElementById('btn-minus').addEventListener('click', function(){ qty=Math.max(1,qty-1); renderPrice(); });\n  document.getElementById('btn-plus').addEventListener('click', function(){ qty++; renderPrice(); });\n  \/\/ === UNICA MODIFICA: COLLEGAMENTO SHOPIFY ===\n  document.getElementById('btn-cart').addEventListener('click', function(){\n    var btn = this;\n    var c2 = calc();\n    var totalQty2 = c2.tot*qty;\n    var sconto2 = 0;\n    if(totalQty2\u003e=150) sconto2=5; else if(totalQty2\u003e=80) sconto2=4; else if(totalQty2\u003e=50) sconto2=3;\n    var totScont2 = totalQty2*(1-sconto2\/100);\n\n    \/\/ Trova variant ID automaticamente\n    let variantId = null;\n    try {\n      const formInput = document.querySelector('form[action*=\"\/cart\/add\"] input[name=\"id\"]');\n      if(formInput) variantId = formInput.value;\n      if(!variantId){\n        const scripts = document.querySelectorAll('script');\n        for(let s of scripts){\n          const m = s.textContent.match(\/\"id\"\\s*:\\s*(\\d{10,})\/);\n          if(m){ variantId = m[1]; break; }\n        }\n      }\n    } catch(e){}\n\n    if(!variantId){\n      alert('Errore: Variant ID non trovato. Assicurati che il prodotto sia attivo. Totale: '+totScont2.toFixed(2)+'€');\n      return;\n    }\n\n    btn.textContent = 'Aggiungo...'; btn.disabled=true;\n    var props = {\n      'Montaggio': montaggi.find(x=\u003ex.id===selMont).nome,\n      'Larghezza': c2.larg+' cm ('+c2.lm+' mm)',\n      'Altezza': c2.alt+' cm ('+c2.am+' mm)',\n      'Tessuto': selTess.it+' ('+selTess.name+')',\n      'Profilo': selProf.name,\n      'Superficie': c2.m2.toFixed(3)+' m²',\n      'Prezzo calcolato': totScont2.toFixed(2)+'€',\n      '_price': c2.tot.toFixed(2)\n    };\n\n    fetch('\/cart\/add.js',{\n      method:'POST',\n      headers:{'Content-Type':'application\/json','Accept':'application\/json'},\n      body: JSON.stringify({id: variantId, quantity: qty, properties: props})\n    }).then(r=\u003er.json().then(j=\u003e({ok:r.ok, j}))).then(res=\u003e{\n      if(!res.ok) throw new Error(res.j.description||'Errore carrello');\n      document.getElementById('plisse-msg').innerHTML='\u003cspan style=\"color:#16a34a;font-weight:700\"\u003e✓ Aggiunto al carrello! Vado al carrello...\u003c\/span\u003e';\n      setTimeout(()=\u003e{ window.location.href=\"\/es\/cart\"; }, 800);\n    }).catch(err=\u003e{\n      document.getElementById('plisse-msg').innerHTML='\u003cspan style=\"color:#dc2626\"\u003eErrore: '+err.message+'\u003c\/span\u003e';\n      btn.textContent='Riprova - '+totScont2.toFixed(2)+'€'; btn.disabled=false;\n    });\n  });\n}\n\nfunction renderAll(){\n  renderMont();\n  renderTess();\n  renderProf();\n  renderPrice();\n}\n\ndocument.getElementById('larg').addEventListener('input', renderPrice);\ndocument.getElementById('alt').addEventListener('input', renderPrice);\nrenderAll();\n})();\n\u003c\/script\u003e\n\u003c\/div\u003e","brand":"Shop17","offers":[{"title":"Default Title","offer_id":59515460354373,"sku":null,"price":1.0,"currency_code":"EUR","in_stock":true}],"url":"https:\/\/shop17.it\/es\/products\/tenda-plissettata-su-misura","provider":"Shop17","version":"1.0","type":"link"}