templates/product/detail.html.twig line 1

Open in your IDE?
  1. {% extends 'layouts/layout.html.twig' %}
  2. {% block content %}
  3.     {% do pimcore_head_title().set(product.codice ~ " - " ~ product.categories[0].name ~ " | Busetto") %}
  4.     {% do pimcore_head_meta().setDescription(metaDescription, 160) %}
  5.     {% set breadcrumbData = product.getCategoryBreadcrumb() %}
  6.     {% set breadcrumb = "" %}
  7.     {% set prelocal = "" %}
  8.     {% set precat = "" %}
  9.     {% if breadcrumbData is not empty %}
  10.         {% if app.request.locale == 'it' %}
  11.             {% set prelocal = "/it/prodotti/" %}
  12.             {% set precat = "/ Prodotti " %}
  13.         {% elseif app.request.locale == 'en' %}
  14.             {% set prelocal = "/en/products/" %}
  15.             {% set precat = "/ Products " %}
  16.         {% endif %}
  17.         {% set breadcrumb = precat ~ '/ <a href="' ~ prelocal ~ breadcrumbData.url ~ '">' ~ breadcrumbData.name ~ '</a> ' %}
  18.     {% endif %}
  19. <main role="main" class="single-product mt-100 pt-0 pt-lg-100">
  20.     <div class="fs-15 breadcrumbs mb-10 mx-10 mx-md-40 mx-lg-70">
  21.         <a href="/">{{ 'Home'|trans }}</a> {{ breadcrumb|raw }}/ {{ product.nome }}
  22.     </div>
  23.   {{ pimcore_areablock("areaBlock") }}
  24.   <div class="pb-20 mx-10 mx-md-40 mx-lg-70 ">
  25.     <div class="row gx-0 gx-lg-70">
  26.       <div class="col-12 col-xl-7">
  27.         <!--{# start swiper product details #}-->
  28.         <div class="d-flex flex-column flex-lg-row gallery-product">
  29.           <div class="col-12 col-lg-2 order-2 order-lg-1 my-30 my-lg-0">
  30.             <div class="swiper swiper-thumbs">
  31.               <div class="swiper-wrapper">
  32.                   {% if product.fotoPricipale is not empty %}
  33.                       <div class="swiper-slide thumb p-10" style="background-image:url({{ product.fotoPricipale.getThumbnail("product_thumbnail_gallery").getPath() }})">
  34.                           <!-- {{ product.fotoPricipale.getThumbnail("product_thumbnail_gallery").getHtml()|raw }} -->
  35.                       </div>
  36.                   {% endif %}
  37.                   {% if product.foto2 is not empty %}
  38.                     <div class="swiper-slide thumb p-5" style="background-image:url({{ product.foto2.getThumbnail("product_thumbnail_gallery").getPath() }})">
  39.                         <!-- {{ product.foto2.getThumbnail("product_thumbnail_gallery").getHtml()|raw }} -->
  40.                     </div>
  41.                   {% endif %}
  42.                   {% if product.foto3 is not empty %}
  43.                       <div class="swiper-slide thumb p-5" style="background-image:url({{ product.foto3.getThumbnail("product_thumbnail_gallery").getPath() }})">
  44.                           <!-- {{ product.foto3.getThumbnail("product_thumbnail_gallery").getHtml()|raw }} -->
  45.                       </div>
  46.                   {% endif %}
  47.                   {% if product.foto4 is not empty %}
  48.                       <div class="swiper-slide thumb p-5" style="background-image:url({{ product.foto4.getThumbnail("product_thumbnail_gallery").getPath() }})">
  49.                           <!-- {{ product.foto4.getThumbnail("product_thumbnail_gallery").getHtml()|raw }} -->
  50.                       </div>
  51.                   {% endif %}
  52.               </div>
  53.             </div>
  54.           </div>
  55.           <div class="ms-0 ms-lg-20 col-12 col-lg-10 order-1 order-lg-2 p-5 position-relative">
  56.               {% if product.url3d %}
  57.                   <div class="banner3d-container">
  58.                     <a href="{{ product.url3d }}" class="banner3d" target="_blank">
  59.                       <span>{{ 'TEXT3D'|trans|raw }}</span>
  60.                     </a>
  61.                   </div>
  62.               {% endif %}
  63.             <div class="swiper swiper-slider">
  64.               <div class="swiper-wrapper">
  65.                   {% if product.fotoPricipale is not empty %}
  66.                     <div class="swiper-slide">
  67.                       <a href="#" data-bs-toggle="modal" data-bs-target="#imageModal" data-image="{{ product.fotoPricipale.thumbnail('product_main') }}" class="d-block d-lg-none">
  68.                         <div class=" position-absolute top-0 end-0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 17 17"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg></div>
  69.                       </a>
  70.                       {% if product.fotoPricipale.getMetadata('alt') is not null and product.fotoPricipale.getMetadata('alt') is not empty %}
  71.                           {{ product.fotoPricipale.getThumbnail("product_main").getHtml()|raw }}
  72.                       {% else %}
  73.                           {% set alt_image = "Busetto " ~ product.codice ~ " " ~ product.descrizione|split(". ")[0] ~ " 1"  %}
  74.                           {{ product.fotoPricipale.thumbnail("product_main").html({'alt': alt_image})|raw }}
  75.                       {% endif %}
  76.                     </div>
  77.                   {% endif %}
  78.                   {% if product.foto2 is not empty %}
  79.                       <div class="swiper-slide">
  80.                         <a href="#" data-bs-toggle="modal" data-bs-target="#imageModal" data-image="{{ product.foto2.thumbnail('product_main') }}" class="d-block d-lg-none">
  81.                           <div class=" position-absolute top-0 end-0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 17 17"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg></div>
  82.                         </a>
  83.                         {% if product.foto2.getMetadata('alt') is not null and product.foto2.getMetadata('alt') is not empty %}
  84.                             {{ product.foto2.getThumbnail("product_main").getHtml()|raw }}
  85.                         {% else %}
  86.                             {% set alt_image = "Busetto " ~ product.codice ~ " " ~ product.descrizione|split(". ")[0] ~ " 2"  %}
  87.                             {{ product.foto2.thumbnail("product_main").html({'alt': alt_image})|raw }}
  88.                         {% endif %}
  89.                       </div>
  90.                   {% endif %}
  91.                   {% if product.foto3 is not empty %}
  92.                       <div class="swiper-slide">
  93.                         <a href="#" data-bs-toggle="modal" data-bs-target="#imageModal" data-image="{{ product.foto3.thumbnail('product_main') }}" class="d-block d-lg-none">
  94.                           <div class=" position-absolute top-0 end-0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 17 17"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg></div>
  95.                         </a>
  96.                         {% if product.foto3.getMetadata('alt') is not null and product.foto3.getMetadata('alt') is not empty %}
  97.                             {{ product.foto3.getThumbnail("product_main").getHtml()|raw }}
  98.                         {% else %}
  99.                             {% set alt_image = "Busetto " ~ product.codice ~ " " ~ product.descrizione|split(". ")[0] ~ " 3"  %}
  100.                             {{ product.foto3.thumbnail("product_main").html({'alt': alt_image})|raw }}
  101.                         {% endif %}
  102.                       </div>
  103.                   {% endif %}
  104.                   {% if product.foto4 is not empty %}
  105.                       <div class="swiper-slide">
  106.                         <a href="#" data-bs-toggle="modal" data-bs-target="#imageModal" data-image="{{ product.foto4.thumbnail('product_main') }}" class="d-block d-lg-none">
  107.                           <div class=" position-absolute top-0 end-0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 17 17"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/></svg></div>
  108.                         </a>
  109.                         {% if product.foto4.getMetadata('alt') is not null and product.foto4.getMetadata('alt') is not empty %}
  110.                             {{ product.foto4.getThumbnail("product_main").getHtml()|raw }}
  111.                         {% else %}
  112.                             {% set alt_image = "Busetto " ~ product.codice ~ " " ~ product.descrizione|split(". ")[0] ~ " 4"  %}
  113.                             {{ product.foto4.thumbnail("product_main").html({'alt': alt_image})|raw }}
  114.                         {% endif %}
  115.                       </div>
  116.                   {% endif %}
  117.               </div>
  118.               <div class="swiper-pagination"></div>
  119.             </div>
  120.             <!-- Modale per l'immagine -->
  121.             <div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
  122.                 <div class="modal-dialog modal-lg modal-fullscreen-lg-down modal-dialog-centered">
  123.                     <div class="modal-content rounded-0">
  124.                         <div class="modal-header border-0">
  125.                             <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  126.                         </div>
  127.                         <div class="modal-body" id="modalImageContainer">
  128.                           <!-- image container -->
  129.                         </div>
  130.                     </div>
  131.                 </div>
  132.             </div>
  133.           </div>
  134.         </div>
  135.         <!--{# end swiper product details #}-->
  136.       </div>
  137.       <div class="col-12 col-xl-5 mb-30">
  138.         {% include '/inc/social-share.html.twig' %}
  139.         <h1>{{ product.nome }}</h1>
  140.         <p class="m-0">{{ product.descrizione|raw }}</p>
  141.         {% if product.tag is not empty %}
  142.         <div class="tags d-flex gap-10 mt-10">
  143.           {% for tag in product.tag %}
  144.           <span class="tag border border-deep-gray px-10 rounded-4">{{ tag.name }}</span>
  145.           {% endfor %}
  146.         </div>
  147.         {% endif %}
  148.         <div class="downloads d-flex gap-50 my-80">
  149.           {# <a href="#" class="download"><i class="fa fa-download me-10"></i>Scarica scheda tecnica</a>
  150.           <a href="#" class="download"><i class="fa fa-download me-10"></i>Scarica catalogo materiali</a> #}
  151.         </div>
  152.         {% if product.famiglia is not empty %}
  153.         <h4>{{ 'Nella stessa collezione'|trans }}</h4>
  154.         <div class="category-products d-flex gap-20">
  155.           <div class="swiper swiper-slider pb-40">
  156.             <div class="swiper-wrapper">
  157.               {% for prodotto in product.famiglia %}
  158.               <div class="swiper-slide">
  159.                 <a href="{{ prodotto.url[0].slug }}" class="product text-center fs-14 col-6 col-md-3">
  160.                   <div class="image p-10">
  161.                       {% if prodotto.fotoPricipale is not empty %}
  162.                           <!--<img src="/assets/images/temp/chairs/s035.jpg" alt="s035" class="w-100 m-auto d-block pb-20">-->
  163.                           {{ prodotto.fotoPricipale.getThumbnail("product_thumbnail_family").getHtml()|raw }}
  164.                       {% else %}
  165.                           <img src="/busetto-placeholder.jpg" alt="" class="w-100 m-auto d-block pb-20">
  166.                       {% endif %}
  167.                   </div>
  168.                   <span class="fw-bold d-inline-block w-100 text-center">{{ prodotto.nome }}</span>
  169.                 </a>
  170.               </div>
  171.               {% endfor %}
  172.             </div>
  173.             <div class="swiper-pagination"></div>
  174.           </div>
  175.         </div>
  176.         {% endif %}
  177.       </div>
  178.     </div>
  179.     <ul class="nav nav-underline mb-3 justify-content-between justify-content-lg-start gap-lg-80 border-bottom border-light-gray" role="tablist" id="specs-tabs" style="position:relative; z-index: 1;">
  180.       <li class="nav-item" role="presentation">
  181.         <a class="h3 nav-link m-0 p-0 active" id="size-lnk" data-mdb-toggle="tab" href="#size-tab" role="tab"
  182.           aria-controls="size-tab" aria-selected="true">{{ 'Dimensioni'|trans }}</a>
  183.       </li>
  184.         {% if rivestimenti is not empty %}
  185.       <li class="nav-item" role="presentation">
  186.         <a class="h3 nav-link m-0 p-0" id="coatings-lnk" data-mdb-toggle="tab" href="#coatings-tab" role="tab"
  187.           aria-controls="coatings-tab" aria-selected="false" data-catids="{{ rivestimenti }}" data-loc="{{ app.request.locale }}">{{ 'Rivestimenti'|trans }}</a>
  188.       </li>
  189.         {% endif %}
  190.         {% if finiture is not empty %}
  191.       <li class="nav-item" role="presentation">
  192.         <a class="h3 nav-link m-0 p-0" id="finishes-lnk" data-mdb-toggle="tab" href="#finishes-tab" role="tab"
  193.           aria-controls="finishes-tab" aria-selected="false" data-catids="{{ finiture }}" data-loc="{{ app.request.locale }}">{{ 'Finiture'|trans }}</a>
  194.       </li>
  195.         {% endif %}
  196.     </ul>
  197.     <!-- Tabs navs -->
  198.     <!-- Tabs content -->
  199.     <div class="tab-content pb-40">
  200.       <div class="tab-pane fade show active" id="size-tab" role="tabpanel" aria-labelledby="size-lnk">
  201.         {% include 'product/dimensioni.html.twig' %}
  202.       </div>
  203.       <div class="tab-pane fade" id="coatings-tab" role="tabpanel" aria-labelledby="coatings-lnk">
  204.           {% include 'product/rivestimenti.html.twig' %}
  205.       </div>
  206.       <div class="tab-pane fade" id="finishes-tab" role="tabpanel" aria-labelledby="finishes-lnk">
  207.           {% include 'product/finiture.html.twig' %}
  208.       </div>
  209.     </div>
  210.     <!-- Tabs content -->
  211.     {% if product.correlati is not empty %}
  212.     <div class="row pt-40 pb-80 border-top related-products">
  213.       <h3 class="text-center">{{ 'Potrebbero interessarti'|trans }}</h3>
  214.       <div class="related-products d-flex gap-20">
  215.         <div class="swiper swiper-slider pb-40">
  216.           <div class="swiper-wrapper">
  217.             {% for prodotto in product.correlati %}
  218.             <div class="swiper-slide">
  219.               <a href="{{ prodotto.url[0].slug }}" class="product text-center fs-14 col-6 col-md-3 col-6 col-md-3">
  220.                 <div class="image p-10 p-md-30">
  221.                     {% if prodotto.fotoPricipale is not empty %}
  222.                         <!--<img src="/assets/images/temp/chairs/s035.jpg" alt="s035" class="w-100 m-auto d-block pb-20">-->
  223.                         {{ prodotto.fotoPricipale.getThumbnail("product_related").getHtml()|raw }}
  224.                     {% else %}
  225.                     <picture>
  226.                         <img src="/busetto-placeholder.jpg" alt="" class="w-100 m-auto d-block pb-20">
  227.                         </picture>
  228.                     {% endif %}
  229.                 </div>
  230.                 <span class="fw-bold d-inline-block w-100 text-center">{{ prodotto.nome }}</span>
  231.               </a>
  232.             </div>
  233.             {% endfor %}
  234.           </div>          
  235.             <div class="swiper-pagination"></div>
  236.         </div>
  237.       </div>
  238.     </div>
  239.     {% endif %}
  240.   </div>
  241. </main>
  242. <style>
  243. .zoom-container {
  244.     position: relative;
  245.     overflow: auto; /* Abilita lo scrolling */
  246.     width: 100%;
  247.     height: 100%;
  248.     touch-action: auto; /* Permette il pinch-to-zoom nativo */
  249. }
  250. .zoom-image {
  251.     display: flex;
  252.     justify-content:center;
  253.     align-items:center;
  254.     width: 100%;
  255.     height: 100%;
  256.     max-width: none;
  257.     max-height: none;
  258.     object-fit: contain;
  259.     cursor: grab;
  260.     transform: scale(1); 
  261.     transition: transform 0.2s ease;
  262. }
  263. </style>
  264. {% do pimcore_head_script().appendFile(swiper_js) %}    
  265. <script>
  266.   document.addEventListener("DOMContentLoaded", (event) => {
  267.   var thumbsSwiper = new Swiper('.gallery-product .swiper-thumbs', {
  268.     slidesPerView: '4',
  269.     direction: 'horizontal',
  270.     spaceBetween: 10,    
  271.     //preventClicks: false,
  272.     //preventClicksPropagation: false,
  273.     //simulateTouch: false,
  274.     pagination: {
  275.       el: '.swiper-pagination',
  276.       type: 'bullets',
  277.       clickable: true,
  278.     },
  279.     breakpoints: {
  280.       992: {
  281.         slidesPerView: 'auto',
  282.         direction: 'vertical',
  283.         spaceBetween: 20,
  284.       }
  285.     }
  286.   });
  287.   var slider = new Swiper('.gallery-product .swiper-slider', {
  288.     slidesPerView: 1,
  289.     spaceBetween: 0,
  290.     //preventClicks: false,
  291.     //preventClicksPropagation: false,
  292.     //simulateTouch: false,
  293.     thumbs: {
  294.       swiper: thumbsSwiper,
  295.     }
  296.   });
  297.   var categorySwiper = new Swiper('.category-products .swiper-slider', {
  298.     slidesPerView: 2,
  299.     spaceBetween: 20,
  300.     //preventClicks: false,
  301.     //preventClicksPropagation: false,
  302.     //simulateTouch: false,
  303.     pagination: {
  304.       el: '.swiper-pagination',
  305.       type: 'bullets',
  306.       clickable: true,
  307.     },
  308.     breakpoints: {
  309.       992: {
  310.         slidesPerView: 4,
  311.       }
  312.     }
  313.   });
  314.   var relatedSwiper = new Swiper('.related-products .swiper-slider', {
  315.     slidesPerView: 2,
  316.     spaceBetween: 20,
  317.     //preventClicks: false,
  318.     //preventClicksPropagation: false,
  319.     //simulateTouch: false,
  320.     pagination: {
  321.       el: '.swiper-pagination',
  322.       type: 'bullets',
  323.       clickable: true,
  324.     },
  325.     breakpoints: {
  326.       992: {
  327.         slidesPerView: 4,
  328.       }
  329.     }
  330.   });
  331.   const triggerTabList = document.querySelectorAll('#specs-tabs a');
  332.   triggerTabList.forEach(triggerEl => {
  333.     const tabTrigger = new bootstrap.Tab(triggerEl);
  334.     triggerEl.addEventListener('click', event => {
  335.       event.preventDefault();
  336.       tabTrigger.show();
  337.     });
  338.   });
  339.   // modal - image zoom
  340.   const modalImageContainer = document.getElementById('modalImageContainer');
  341.   document.querySelectorAll('.swiper-slide a[data-bs-toggle="modal"]').forEach(function (link) {
  342.     link.addEventListener('click', function () {
  343.       // Ottieni l'immagine dal data-attribute
  344.       const image = this.getAttribute('data-image');
  345.       const imageHtml = `<img src="${image}" alt="zoom immagine" class="zoom-image" />`;
  346.       if (imageHtml) {
  347.           // Aggiorna il contenuto del modale
  348.           modalImageContainer.innerHTML = '<div class="zoom-container">'+imageHtml+'</div>';
  349.       }
  350.     });
  351.   });
  352. });
  353. </script>
  354. {% endblock %}