templates/front/theme1/produits/page_produit.html.twig line 1

Open in your IDE?
  1. {% extends "front/"~ app.request.server.get('APP_THEME') ~"/base.html.twig" %}
  2. {% set parametre = ParametreSite() %}
  3. {% block preload %}
  4.     {% if post.image is defined  and post.image is not empty %}
  5.         {% if post.image %}
  6.             <link rel="preload" as="image" href="{{asset_image(post.image)}}" />
  7.         {% endif %}
  8.     {% endif %}
  9.      {% if galleries is defined and galleries is not empty %}
  10.            {% for item in galleries %}
  11.                 {% if item.path is defined %}
  12.                     <link rel="preload" as="image" href="{{asset_image_gallery(item.path)}}" />
  13.                 {% endif %}
  14.            {% endfor %}
  15.     {% endif %}
  16. {% endblock %}
  17. {% block stylesheets %}
  18.     {{parent()}}
  19.     {% if modele_galerie[0].type == 4 %}
  20.         <link rel="stylesheet" type="text/css" href="{{asset('templates/front/theme1/assets/plugins/flexslider/flexslider.css')}}" media="screen" >
  21.     {% endif %}
  22. {% endblock %}
  23. {% block body %}
  24.     {% set position_image = post.positionimage %}
  25.     {% set class_position = "" %}
  26.     {% if post.positionimage == 2 %}
  27.         {% set class_position = "float-md-left mb-2 mr-md-3"  %}
  28.     {% elseif post.positionimage == 3 %}
  29.         {% set class_position = "float-md-right mb-2 ml-md-3" %}
  30.     {% endif %}
  31.     {% if post.imageBandeau %}
  32.         {% set imagebandeau = post.imageBandeau %}
  33.     {% elseif parametre.imageBandeau %}
  34.         {% set imagebandeau = 'uploads/images/' ~ parametre.imageBandeau %}
  35.     {% else %}
  36.         {% set imagebandeau = '' %}
  37.     {% endif %}
  38.     
  39.     {% if imagebandeau != '' %}
  40.         <section class="image-bandeau text-center">
  41.             <img class="lazyload" alt="{{post.title}}" title="{{post.title}}" data-srcset="{{imagebandeau}}" src="{{asset(imagebandeau)}}" />
  42.             <div class="cnt-bandeau text-center">
  43.                 <div class="container-fluid wrapper">
  44.                     <div class="breadcrumb-style-default">
  45.                         <div class="row">
  46.                             <div class="col-lg-12">
  47.                                 <div class="inner text-center">
  48.                                     {% if breadcrumb is defined and breadcrumb is not empty %}
  49.                                         {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/partials/breadcrumb.html.twig')}}
  50.                                     {% endif %}
  51.                                 </div>
  52.                             </div>
  53.                         </div>
  54.                     </div>
  55.                     <h1 class="page-title">{{post.title|raw}}</h1>
  56.                 </div>
  57.             </div>
  58.         </section>
  59.     {% endif %}
  60.     <div class="page_product pt-5">
  61.         {% if imagebandeau == '' %}
  62.         <div class="breadcrumb-style-default">
  63.             <div class="container">
  64.                 <div class="row">
  65.                     <div class="col-lg-12">
  66.                         <div class="inner text-center">
  67.                             {% if breadcrumb is defined and breadcrumb is not empty %}
  68.                                 {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/partials/breadcrumb.html.twig')}}
  69.                                  {% if post.image is empty  %}
  70.                                     <h1 class="page-title">{{breadcrumb|last.name}}</h1>
  71.                                 {% endif %}
  72.                             {% endif %}
  73.                         </div>
  74.                     </div>
  75.                 </div>
  76.             </div>
  77.         </div>
  78.         {% endif %}
  79.         <div class="container-fluid  {{categories_tree is defined and categories_tree is not empty?'':'wrapper'}} mt-3">
  80.             <div class="row gx-5 py-2">
  81.                 {% if categories_tree is defined and categories_tree is not empty %}
  82.                     <div class="col-sm-12 col-md-3 {{show_filter_categorie is defined and show_filter_categorie == true ?'':'d-none'}}">
  83.                          {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/partials/product/_sidebar.html.twig')}}
  84.                     </div>
  85.                 {% endif %}
  86.                 
  87.                 <div class="col-sm-12 col-md-{{show_filter_categorie is defined and show_filter_categorie == true?'9':'12'}} bloc-content-produit">
  88.                      <div class="row">
  89.                             <div class="col-sm-12 col-lg-6">
  90.                                 {% if not (modele_galerie[0].type == 4 and galleries|length > 1) %}
  91.                                 <div class="image-product">
  92.                                     {% if post.image and post.image is not empty  %}
  93.                                         <a href="{{asset_image(post.image,'medium')}}" data-fancybox="image" tirle="{{post.titre}}" >
  94.                                            <img class="img-fluid" data-srcset="{{asset_image(post.image,'medium')}}" src="{{asset_image(post.image,'medium')}}" alt="{{post.titre}}" />
  95.                                         </a>
  96.                                       
  97.                                     {% elseif galleries is defined and galleries is not empty %}
  98.                                         <a href="{{asset_image_gallery(galleries[0].path)}}" data-fancybox="image" tirle="{{post.titre}}" >
  99.                                             <img class="img-fluid" data-srcset="{{asset_image_gallery(galleries[0].path)}}" src="{{asset_image_gallery(galleries[0].path)}}" alt="{{post.titre}}" />
  100.                                         </a>
  101.                                        
  102.                                     {% elseif parametre.imageVide is defined and parametre.imageVide is not empty %}
  103.                                          <a href="{{asset('/uploads/images/'~ parametre.imageVide)}}" data-fancybox="image" tirle="{{post.titre}}" >
  104.                                            <img class="img-fluid" data-srcset="{{asset('/uploads/images/'~ parametre.imageVide)}}" src="{{asset('/uploads/images/'~ parametre.imageVide)}}" alt="{{post.titre}}" />
  105.                                         </a>
  106.                                     {% endif %}
  107.                                     {% if post.disponibiliteproduit %}
  108.                                         <span class="disponible">{{'disponible'|upper}}</span>
  109.                                     {% endif %}
  110.                                 </div>
  111.                                 {% else %}
  112.                                     {% if galleries and galleries is not empty and template_model_gallerie is defined and template_model_gallerie is not empty %}
  113.                                         <div class="image-product">
  114.                                             {% if (post.image is defined and post.image == null) %}
  115.                                                 {% set galleries = galleries|slice(1) %}
  116.                                             {% endif %}
  117.                                             
  118.                                             {{ include(template_from_string(template_model_gallerie)) }}
  119.                                             {% if post.disponibiliteproduit %}
  120.                                                 <span class="disponible">{{'disponible'|upper}}</span>
  121.                                             {% endif %}
  122.                                         </div>
  123.                                     {% endif %}
  124.                                 {% endif %}
  125.                             </div>
  126.                             <div class="col-sm-12 col-lg-6 mt-lg-0 mt-4">
  127.                                 {% if post.image and post.image is not empty and imagebandeau == ''  %}
  128.                                     <h1 class="page-title">{{breadcrumb|last.name}}</h1>
  129.                                 {% endif %}
  130.                                 {% if post.content is not empty and post.content != " " %}
  131.                                     {{post.content|raw}}
  132.                                 {% endif %}
  133.                                
  134.                                 {% if post.prixproduit %}
  135.                                     <div class="price_product"> Prix : <span>{{post.prixproduit}}</span> € </div>
  136.                                 {% endif %}
  137.                                 
  138.                                 {% if post.referanceproduit %}
  139.                                     <div class="ref_product"> Réf : <strong>{{post.referanceproduit}} </strong></div>
  140.                                 {% endif %}
  141.                                 {% if champsPersonnalisesPost is defined and champsPersonnalisesPost is not empty %}
  142.                                     <div class="autre_info">
  143.                                         {% for item in champsPersonnalisesPost %}
  144.                                              <div class="item d-flex">
  145.                                                 <div class="label"> {{item.label}} : </div>
  146.                                                 <div class="value"> {{item.value}}</div>
  147.                                             </div>
  148.                                         {% endfor %}
  149.                                     </div>
  150.                                 {% endif %}
  151.                                 
  152.                                     
  153.                                     
  154.                                 {% if post.prixproduit is not empty %}
  155.                                     {% if post.typepost.parametrepost[0] is defined and  post.typepost.parametrepost[0].actifpanier == true %}
  156.                                         <div class="input-quantite">
  157.                                             <label>Quantité :</label>
  158.                                             <input type="number" class="form-control quantite" value="1" min="1" name="qte" />
  159.                                         </div>
  160.                                     {% endif %}
  161.                                 {% endif %}
  162.                                 {% if post.typepost.parametrepost[0] is defined and (post.typepost.parametrepost[0].actifpanier == true or post.typepost.parametrepost[0].buttoninteresse != "") %}
  163.                                     <div class="d-flex mt-3 boutons-panier">
  164.                                         {% if post.prixproduit is not empty and post.typepost.parametrepost[0].actifpanier == true %}
  165.                                             <button title="Ajouter au panier" class="btn btn-add-panier">Ajouter au panier</button>
  166.                                         {% endif %}
  167.                                         
  168.                                         {% if post.typepost.parametrepost[0].buttoninteresse != "" and slug_page_contact('page-contact') != null %}
  169.                                            <a href="{{path('page',{slug:slug_page_contact('page-contact')})}}?product={{post.slug}}" class="btn btn-interesse">{{post.typepost.parametrepost[0].buttoninteresse}}</a>
  170.                                         {% endif %}
  171.                                     </div>
  172.                                 {% endif %}                          
  173.                             </div>
  174.                             {% if post.produitsinfo is defined and post.produitsinfo is not empty %}
  175.                                 <div class="col-md-12">
  176.                                     <div class="product-tabs">
  177.                                         <ul class="tabs">
  178.                                             {% for key,item in post.produitsinfo %}
  179.                                                 <li class="tab-link {{key == 0?'current':''}}" data-tab="tab-{{key + 1}}">{{item.titre|upper}}</li>
  180.                                             {% endfor %}
  181.                                         </ul>
  182.                                         <div class="">
  183.                                             {% for key,item in post.produitsinfo %}
  184.                                                 <div id="tab-{{key + 1}}" class="tab-content {{key == 0?'current':''}}">{{item.text|raw}}</div>
  185.                                             {% endfor %}
  186.                                         </div>
  187.                                     </div>
  188.                                 </div>
  189.                             {% endif %}
  190.                             <div class="col-sm-12">
  191.                                     {% if post.typelien == null %}
  192.                                             {% if categorieTree is defined and categorieTree[0] is defined  %}
  193.                                                 <div class="text-center py-2">
  194.                                                     <a href="{{path('page',{slug:categorieTree[0].slug})}}" class="btn btn-cms py-3 px-5 mt-3 btn-plus">Retour à la liste {{categorieTree[0].titre}}</a>
  195.                                                 </div>
  196.                                             {% endif %}
  197.                                     {% elseif post.typelien != 1 %}
  198.                                             {% if post.typelien == '4' %}
  199.                                                 <div class="text-center py-2">
  200.                                                     <a href="javascript:void(0)" onclick="window.location.href = 'tel:{{post.telephone}}';" class="btn btn-cms py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  201.                                                 </div>
  202.                                             {% elseif post.typelien == '2' %}
  203.                                                 <div class="text-center py-2">
  204.                                                     <a href="{{slug_link_interne(post.lieninterne)}}" class="btn btn-cms py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  205.                                                 </div>
  206.                                             {% elseif post.typelien == '3' %}
  207.                                                 <div class="text-center py-2">
  208.                                                     <a href="{{post.lienexterne}}" target="_blank" class="btn btn-cms py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  209.                                                 </div>
  210.                                             {% endif %}
  211.                                     {% endif %}
  212.                                     {% if docs and docs is not empty %}
  213.                                         <div class="col-md-12 bloc-docs d-flex justify-content-center">
  214.                                             {% for doc in docs %}
  215.                                                 <a class="btn-back-pulse m-2" href="{{doc.location ~ doc.path ~ '/' ~ doc.fileName}}" title="{{doc.titre}}" target="_blank"><i class="fa fa-file-pdf-o mr-2"></i>{{doc.titre}}</a>   
  216.                                             {% endfor %}
  217.                                         </div>
  218.                                     {% endif %}
  219.                             </div>
  220.                      </div>
  221.                 </div>
  222.             </div>
  223.         </div>
  224.         {% if galleries and galleries is not empty and template_model_gallerie is defined and template_model_gallerie is not empty and modele_galerie[0].type != 4 %}
  225.             {% if (post.image is defined and post.image == null) %}
  226.                   {% set galleries = galleries|slice(1) %}
  227.             {% endif %}
  228.             
  229.             {{ include(template_from_string(template_model_gallerie)) }}
  230.         {% endif %}
  231.         {% if post.urlvideo is not empty %}
  232.             <div class="container-fluid wrapper mt-3">
  233.                 <div class="col-md-12 mt-1">
  234.                     <div class="video">
  235.                         {% set id_video_externe = post.urlvideo|split('?v=')[1] %}
  236.                         <a class="video-thumbnail m-0" href="{{post.urlvideo}}" data-fancybox="video">
  237.                             <img src="https://img.youtube.com/vi/{{id_video_externe}}/maxresdefault.jpg" class="img-fluid" alt=""/>
  238.                         </a>
  239.                     </div>
  240.                 </div>
  241.             </div>
  242.         {% endif %}
  243.         {% if blocs is defined  %}
  244.             {% for bloc in blocs.Bloc %}
  245.                 {% if is_mobile() and  bloc.mobile == true   %}
  246.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  247.                         bloc: bloc,
  248.                     }, with_context = false)}}
  249.                 {% endif %}
  250.                 
  251.                 {% if is_full_view() and is_mobile() == false and bloc.desktop == true %}
  252.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  253.                         bloc: bloc,
  254.                     }, with_context = false)}}
  255.                 {% endif %}
  256.             {% endfor %}
  257.         {% endif %} 
  258.         {% if produit_related is defined and produit_related is not empty %}
  259.             <section class="">
  260.                     <div class="container-fluid  mt-3">
  261.                         <div class="row gx-5 py-2">
  262.                             <div class="col-sm-12 text-center">
  263.                                 {% if post.typepost.parametrepost[0] is defined %}
  264.                                     <h2 class="sub-title wow">{{post.typepost.parametrepost[0].titreblocproduitrelated}}</h2>
  265.                                 {% endif %}
  266.                             </div>
  267.                             <div class="col-sm-12">
  268.                                 <div class="list_blocs pos1">
  269.                                     <div class="blocs">
  270.                                         <section class="results dynam-affichage affichage1 type_affiche3 ">
  271.                                             {% for item in produit_related %}
  272.                                                 {% set duree = 0.1 %}
  273.                                                 {% set prix = "" %}
  274.                                                 
  275.                                                 {% if item.prixproduit is defined %}
  276.                                                     {% set prix = item.prixproduit %}
  277.                                                 {% endif %}
  278.                                                 
  279.                                                 {% set image_item = item.image != null? asset_image(item.image): null %}
  280.                                                 {% if image_item == null %}
  281.                                                     {% set filteredItems = resultats_first_images_produits|filter(p => p.id == item.id) %}
  282.                                                     {% for first_gallerie_image in filteredItems %}
  283.                                                         
  284.                                                         {% set image_item = first_gallerie_image.galleries_first_image != null? asset_image_gallery(first_gallerie_image.galleries_first_image): null %}
  285.                                                         
  286.                                                     {% endfor %}
  287.                                                 {% endif %}
  288.                                                 {% set image_item = image_item != null? image_item :asset('uploads/images/' ~ parametre.imagevide) %}
  289.                                                 <div class="article wow zoomIn animated" {% if prix is not empty and (param_post is defined and param_post.actifprixliste is defined and param_post.actifprixliste == 1) %}data-prix="{{prix}}"{% endif %} data-wow-delay="{{duree}}s" style="visibility: visible; animation-delay: 0.1s; animation-name: zoomIn;">
  290.                                                     <span class="article-image lazyloaded"  style="background-image: url({{image_item}}); background-size: cover; background-position: center center; background-repeat: no-repeat;"> </span>                 
  291.                                                     <span class="article-cnt">
  292.                                                         {% if GetCategory(item.defaultcategorie) %}
  293.                                                             <a class="article-titre" href="{{path('page_sous_categorie',{categorie1:GetCategory(item.defaultcategorie).slugurl,categorie2:item.slug})}}" title="{{item.title|raw}}">{{item.title|raw}}</a> 
  294.                                                         {% endif %} 
  295.                                                         {% if prix is not empty and (param_post is defined and param_post.actifprixliste is defined and param_post.actifprixliste == 1) %}
  296.                                                             <span class="article-prix">{{prix}} €</span>
  297.                                                         {% endif %}
  298.                                                         {% if item.summary is not empty %}
  299.                                                             <span class="article-txt">
  300.                                                                 {{item.summary|raw}}
  301.                                                             </span>
  302.                                                         {% else %}
  303.                                                             <span class="article-txt">
  304.                                                             {% if item.content != "" %}
  305.                                                                 {{cutText(item.content)|raw}}
  306.                                                             {% endif %}
  307.                                                             </span>
  308.                                                         {% endif %}
  309.                                                        
  310.                                                         {% if GetCategory(item.defaultcategorie) %}
  311.                                                             <span class="article-bts">
  312.                                                                 <button class="article-plus btn-fade" onclick="window.open('{{path('page_sous_categorie',{categorie1:GetCategory(item.defaultcategorie).slugurl,categorie2:item.slug})}}', '_self');" title="En savoir plus">En savoir plus</button>
  313.                                                             </span> 
  314.                                                         {% endif %} 
  315.                                                     </span>
  316.                                                 </div>
  317.                                                 {% set duree = duree + 0.2 %}
  318.                                             {% endfor %}
  319.                                         </section>
  320.                                     </div>
  321.                                 </div>
  322.                             </div>
  323.                         </div>
  324.                     </div>
  325.             </section>
  326.         {% endif %}
  327.     </div> 
  328.     {% if post.typepost.parametrepost[0] is defined and post.typepost.parametrepost[0].actifpanier == true %}
  329.         <div id="ModalAjoutPanier" class="modal modal_cart">
  330.             <!-- Modal content -->
  331.             <div class="modal-content">
  332.                 <div  class='top_prod'>Votre produit a été ajouté avec succès<span class="close">&times;</span></div>
  333.                 <div class="modal_content bg_bot">
  334.                         <div id="name_produit2">Produit : <span></span> </div>             
  335.                         <div class="prix_vente2">Prix : <span></span> &euro;</div>
  336.                     <button title="Continuer mes achats" class="btn-continuer link_addSelection_detail2" id="addthis_selection2">Continuer mes achats</button>  
  337.                     {% set espace_client = 1 %} 
  338.                     {% if espace_client %}
  339.                         <button onclick="window.location.href = '/espace-client/login'" title="Ajouter à ma commande" class="btn-back-pulse link_addSelection_detail" id="addthis_selection22">Je termine ma commande</button>  
  340.                     {% else %}
  341.                         <button onclick="window.location.href = '/contact'" title="Ajouter à ma commande" class="btn-back-pulse link_addSelection_detail" id="addthis_selection22">Je termine ma commande</button>
  342.                     {% endif %}
  343.                 </div>
  344.             </div>
  345.         </div> 
  346.     {% endif %}
  347. {% endblock %}
  348. {% block javascripts %}
  349.     {{parent()}}
  350.     {% if post.typepost.parametrepost[0] is defined and post.typepost.parametrepost[0].actifpanier == true %}
  351.         <script>
  352.             $(document).ready(function() {
  353.                 var modal = document.getElementById('ModalAjoutPanier');
  354.                 var closeBtn = modal.getElementsByClassName("close");
  355.                 var continuerBtn = modal.getElementsByClassName("link_addSelection_detail2");
  356.                 $('.btn-add-panier').click(function() {
  357.                     var productId = {{ post.id }};
  358.                     var qte = $('.quantite').val();
  359.                     $.ajax({
  360.                         url: '/panier/add/'+escape(productId)+'/'+escape(qte),
  361.                         type: 'POST',
  362.                         dataType: 'JSON',
  363.                         success: function(response) {
  364.                             var panier = response.panier;
  365.                             updatePanier(panier);
  366.                             if(response.success){
  367.                                 var titre_produit = $('.page-title').text();
  368.                                 var prix_produit = $('.price_product span').text();
  369.                                 $('#name_produit2 span').text(titre_produit);
  370.                                 $('.prix_vente2 span').text(prix_produit);
  371.                                 modal.style.display = "block";
  372.                             }
  373.                         },
  374.                         error: function(xhr, status, error) {
  375.                             console.log(error); // Affichez l'erreur pour le débogage
  376.                         }
  377.                     });
  378.                 });
  379.                 function closeModal() {
  380.                     modal.style.display = "none";
  381.                 }
  382.                 
  383.                 $(closeBtn).click(closeModal);
  384.                 $(continuerBtn).click(closeModal);
  385.             });
  386.         </script>
  387.     {% endif %}
  388.     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
  389.     {% if modele_galerie[0].type == 4 %}
  390.         <script src="{{asset('templates/front/theme1/assets/plugins/flexslider/jquery.flexslider.js')}}" ></script>
  391.         <script>    
  392.             if ($(".sx_flexslider").length) {
  393.                 $('.flex-carousel').flexslider({
  394.                     animation: "slide",
  395.                     controlNav: false,
  396.                     animationLoop: true,
  397.                     slideshow: false,
  398.                     itemWidth: 150,
  399.                     asNavFor: '.flex-slider'
  400.                 });
  401.                 $('.flex-slider').flexslider({
  402.                     animation: "slide",
  403.                     controlNav: false,
  404.                     animationLoop: true,
  405.                     slideshow: false,
  406.                     sync: ".flex-carousel"
  407.                 });
  408.             }
  409.         </script>
  410.     {% endif %}
  411.     <script>
  412.         $(document).ready(function(){
  413.             $('ul.tabs li').click(function(){
  414.                 var tab_id = $(this).attr('data-tab');
  415.                 $('ul.tabs li').removeClass('current');
  416.                 $('.tab-content').removeClass('current');
  417.                 $(this).addClass('current');
  418.                 $("#"+tab_id).addClass('current');
  419.             })
  420.         })
  421.     </script>
  422. {% endblock %}