templates/bundles/SyliusShopBundle/Product/show.html.twig line 1

Open in your IDE?
  1. {% extends '@SyliusShop/layout.html.twig' %}
  2. {% block title %}{{ product.name }} | {{ parent() }}{% endblock %}
  3. {% block metatags %}
  4.     {% if product.metaDescription is defined  %}
  5.     <meta name="description" content="{{ product.metaDescription }}">
  6.     {% endif %}
  7. {% endblock %}
  8. {% block banner %}
  9.     {{ render(url('odiseo_sylius_banner_plugin_shop_partial_banner', {'template': '@SyliusShop/Banner/banner1.html.twig'})) }}
  10. {% endblock %}
  11. {% block content %}
  12. <div class="" id="p">
  13.     {% include '@SyliusShop/Product/Show/_breadcrumb.html.twig' %}
  14.     <div class="ui hidden divider"></div>
  15.     <div class="ui two column stackable grid product-details">
  16.     <div class="column product-details__left-col">
  17.         {% set productname = product.name %}
  18.         {% if mode == "gift" %}
  19.             {% set productname =  'sylius.ui.gift.offrez'|trans  %}
  20.         {% endif %}
  21.         <h1 id="sylius-product-name" class="product-details__name" {{ sylius_test_html_attribute('product-name', product.name) }}>{{ productname }}</h1>
  22.         {% if mode == "gift" %}
  23.             {% include '@SyliusShop/Product/Show/_giftcard.html.twig' %}
  24.         {% else %}
  25.             {% include '@SyliusShop/Product/Show/_detailproduct.html.twig' %}
  26.              {% include '@SyliusShop/Product/Show/_productaction.html.twig' %}
  27.         {% endif %}
  28.     </div>
  29.         <div class="column">
  30.             {% if product.images|length == 1 %}
  31.                 {% include '@SyliusShop/Product/Show/_images.html.twig' %}
  32.             {% else %}
  33.                 {% if product.images|length > 1 %}
  34.                 <div class="product-details__slider-main produit">
  35.                         {% for image in product.images %}
  36.                         {% set path = image.path is not null ? image.path|imagine_filter('sylius_large') : '' %}
  37.                             <img src="{{ path }}"  alt="{{ product.name }}" />
  38.                         {% endfor %}
  39.                 </div>
  40.                 <div class="product-details__slider-navigation">
  41.                         {% for image in product.images %}
  42.                         {% set path = image.path is not null ? image.path|imagine_filter('sylius_large') : '' %}
  43.                             <img src="{{ path }}"  alt="{{ product.name }}" />
  44.                         {% endfor %}
  45.                 </div>
  46.                 {% endif %}
  47.             {% endif %}
  48.             {% if product.getVideo() is not empty %}
  49.             <div class="product_video product-details__product_video" style="padding-top:10px;">
  50.               {{ product.getVideo() | raw }}
  51.             </div>
  52.             {% endif %}
  53.             {% if product.getDispoDescription() is not empty %}
  54.             <div class="dispo_description product-details__dispo_description">
  55.               {{ product.getDispoDescription() | raw }}
  56.             </div>
  57.             {% endif %}
  58.         </div>
  59.     </div>
  60.      {% if mode != "gift" %}
  61.         <div class="ui top attached large tabular menu">
  62.             <a class="item active" data-tab="details">{{ 'sylius.product.informationscomplementaires'|trans }}</a>
  63.             {% if SimpleAttributes.pratiques is defined %}
  64.             <a class="item" data-tab="attributes" {{ sylius_test_html_attribute('tab', 'attributes') }}>{{ 'sylius.product.informationspratiques'|trans }}</a>
  65.             {% endif %}
  66.             <a class="item" data-tab="reviews">{{ 'sylius.ui.reviews'|trans }} ({{ product.acceptedReviews|length }})</a>
  67.         </div>
  68.         {% include '@SyliusShop/Product/Show/Tabs/_details.html.twig' %}
  69.         {% include '@SyliusShop/Product/Show/Tabs/_infospratiques.html.twig' %}
  70.         {% include '@SyliusShop/Product/Show/Tabs/_reviews.html.twig' %}
  71.     {% endif %}
  72.         <div class="text-center product-details__back-button">
  73.             <a href="{{ path('app_shop_product_search') }}" class="button button--outline">
  74.                 <i class="fas fa-arrow-left"></i> {{ 'sylius.ui.retourliste'|trans }}
  75.             </a>
  76.         </div>
  77.     {% for association in product.associations %}
  78.         {{ render(url('sylius_shop_partial_product_association_show', {'productId': product.id, 'id': association.id, 'template': '@SyliusShop/Product/Show/_association.html.twig'})) }}
  79.     {% else %}
  80.         <div class="related-products">
  81.             <img class="related-products__icon" src="{{ asset('assets/shop/img/associated-icon.png') }}" alt="{{ 'sylius.ui.produitsassocies'|trans }}">
  82.             <span class="related-products__tagline">{{ 'sylius.ui.produitsassocies'|trans }}</span>
  83.             <h4 class="related-products__title">{{ 'sylius.ui.clientontcommande'|trans }} </h4>
  84.              {{ render(url('sylius_shop_partial_product_index_latest', {'count': 10, 'template': '@SyliusShop/Product/_horizontalList.html.twig'})) }}
  85.         </div>
  86.     {% endfor %}
  87. </div>
  88. {% endblock %}
  89. {% block javascripts %}
  90. {{ parent() }}
  91. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  92. <script type="text/javascript" src="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
  93. <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
  94. <script>
  95.     //lightbox.option({
  96.     //    'albumLabel': '{{ 'sylius.lightbox.image_album_label'|trans|escape('js') }}'
  97.     //});
  98.     $(document).ready(function () {
  99.       $('.sylius_add_to_cart_cartItem_variant_button').on('click', function () {
  100.         var selector = '';
  101.         key = $(this).data( "key" );
  102.         var price = $(this).data( "price" );
  103.         var originalPrice = $(this).data( "originalprice" );
  104.         if (price !== undefined) {
  105.           $('#product-price').text(price);
  106.           if (originalPrice !== undefined && originalPrice != "" && originalPrice != price ) {
  107.             $('#product-original-price').css('display', 'inline').html('<del>' + originalPrice + '</del>');
  108.           } else {
  109.             $('#product-original-price').css('display', 'none');
  110.           }
  111.         } else {
  112.           $('#product-price').text($('#sylius-variants-pricing').attr('data-unavailable-text'));
  113.           $('button[type=submit]').attr('disabled', 'disabled');
  114.         }
  115.       });
  116.         $('.product-details__slider-main').slick({
  117.             slidesToShow: 1,
  118.             slidesToScroll: 1,
  119.             arrows: true,
  120.             fade: true,
  121.             infinite: false,
  122.             asNavFor: '.product-details__slider-navigation',
  123.             autoplay: true,
  124.             autoplaySpeed: 3000
  125.         });
  126.         $('.product-details__slider-navigation').slick({
  127.             slidesToShow: 4,
  128.             slidesToScroll: 1,
  129.             asNavFor: '.product-details__slider-main',
  130.             arrows: false,
  131.             infinite: false,
  132.             focusOnSelect: true,
  133.             autoplay: true,
  134.             autoplaySpeed: 3000
  135.         });
  136.         $('.related-products__products').slick({
  137.             slidesToShow: 3,
  138.             slidesToScroll: 1,
  139.             arrows: true,
  140.             dots: true,
  141.             infinite: false,
  142.             autoplay: true,
  143.             autoplaySpeed: 3000,
  144.             responsive: [
  145.                     {
  146.                         breakpoint: 991,
  147.                         settings: {
  148.                             slidesToShow: 2,
  149.                         }
  150.                     },
  151.                     {
  152.                         breakpoint: 768,
  153.                         settings: {
  154.                             slidesToShow: 1,
  155.                         }
  156.                     },
  157.                 ]
  158.         });
  159.         const hideScreens = () => {
  160.             document.querySelector('#gift_screen1').style.display = 'none'
  161.             document.querySelector('#gift_screen2').style.display = 'none'
  162.             document.querySelector('#gift_screen3').style.display = 'none'
  163.         }
  164.         const showScreen1 = () => {
  165.             document.querySelector('#gift_screen1').style.display = 'block'
  166.         }
  167.         const showScreen2 = () => {
  168.             document.querySelector('#gift_screen2').style.display = 'block'
  169.         }
  170.         const showScreen3 = () => {
  171.             document.querySelector('#gift_screen3').style.display = 'block'
  172.         }
  173.         // form steps
  174.         document.querySelectorAll('.gotostep1').forEach((item) => {
  175.             item.addEventListener('click', (e) => {
  176.                 e.preventDefault();
  177.                 hideScreens();
  178.                 showScreen1();
  179.             })
  180.         })
  181.         document.querySelectorAll('.gotostep2').forEach((item) => {
  182.             item.addEventListener('click', (e) => {
  183.                 e.preventDefault();
  184.                 hideScreens();
  185.                 showScreen2();
  186.             })
  187.         })
  188.         document.querySelectorAll('.gotostep3').forEach((item) => {
  189.             item.addEventListener('click', (e) => {
  190.                 e.preventDefault();
  191.                 hideScreens();
  192.                 showScreen3();
  193.             })
  194.         });
  195.     })
  196. </script>
  197. {% endblock %}