themes/BootstrapTheme/templates/bundles/SyliusShopBundle/Product/show.html.twig line 137

Open in your IDE?
  1. {% set block = app_get_blocks('num_telephone', sylius.channel.code )  %}
  2. {% set block_h = app_get_blocks('horaires_magasin', sylius.channel.code )  %}
  3. {% set block_livr = app_get_blocks('imageperso_index', sylius.channel.code )  %}
  4. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  5. {% set context = {"channel": sylius.channel} %}
  6. {% extends '@SyliusShop/layout.html.twig' %}
  7. {% block title %}
  8.     {% include '@DediSyliusSEOPlugin/Shop/Header/_title.html.twig' with { 'resource': product ?? sylius.channel } %}
  9. {% endblock %}
  10. {% block metatags %}
  11.     {% if product.metaKeywords is not empty %}
  12.         <meta name="keywords" content="{{ product.metaKeywords }}" />
  13.     {% endif %}
  14.     {{ sylius_template_event('dedi_sylius_seo_plugin.metatags', { resource: product ?? sylius.channel }) }}
  15.     {{ sylius_template_event('dedi_sylius_seo_plugin.rich_snippets') }}
  16. {% endblock %}
  17. {% block content %}
  18.     {{ encore_entry_script_tags('fabric', null, 'bootstrapTheme') }}
  19.     {{ encore_entry_script_tags('configurator', null, 'bootstrapTheme') }}
  20.     {{ render(url('app_shop_geolocalisation')) }}
  21.     {% set configurator = false %}
  22.     {% set advancedModel = false %}
  23.     {% if product.isBundle and product.productBundle %}
  24.         {% for productBundleItem in product.productBundle.productBundleItems %}
  25.             {% if productBundleItem.productVariant.model %}
  26.                 {% set configurator = true %}
  27.                 {% if productBundleItem.productVariant.model.advanced %}
  28.                     {% set advancedModel = true %}
  29.                 {% endif %}
  30.             {% endif %}
  31.         {% endfor %}
  32.     {% elseif product.variants|length > 0 %}
  33.         {% for variant in product.variants %}
  34.             {% if variant.model %}
  35.                 {% set configurator = true %}
  36.                 {% if variant.model.advanced %}
  37.                     {% set advancedModel = true %}
  38.                 {% endif %}
  39.             {% endif %}
  40.         {% endfor %}
  41.     {% endif %}
  42.     <div class="hide-cross-page">
  43.         <div id="cross-selling-add-to-cart" class="pt-3">
  44.             <div class="row pt-2 mx-md-n3 mx-0">
  45.                 {% for association in product.associations  %}
  46.                     {% if association.getType().getCode() == "cross_selling_add_to_cart" and association.associatedProducts|length > 0 %}
  47.                         <div class="modal-title titre-popup color-purple-s title-popup-cross-selling">{{'app.product.pour_completer'|trans}}</div>
  48.                         {% for associatedProduct in association.associatedProducts %}
  49.                             {% if associatedProduct.enabled %}
  50.                             {% set variant = associatedProduct|sylius_resolve_variant %}
  51.                             <div class="col-md-4 col-12 border-bottom-mob px-md-3 px-0 mx-md-0 mx-2 mb-4">
  52.                                 <div class="row no-gutters h-100">
  53.                                     <div class="col-md-12 col-sm-3 col-5 max-height-1 pr-md-0 pr-1">
  54.                                         {% if associatedProduct.images|first %}
  55.                                             {% set path = associatedProduct.getImagesByPosition|first.path|imagine_filter(filter|default('sylius_shop_product_thumbnail')) %}
  56.                                         {% else %}
  57.                                             {% set path = asset('images/spacer.png') %}
  58.                                         {% endif %}
  59.                                          <a href="{{ path('sylius_shop_product_show', {'slug': associatedProduct.slug, '_locale': associatedProduct.translation.locale}) }}" title="{{ associatedProduct.name }}" data-id="{{ associatedProduct.id }}"><img src="{{ path }}" alt="{{ associatedProduct.name }} " class="w-100" /></a>
  60.                                     </div>
  61.                                     <div class="col-md-12 col-sm-3 col-7 d-flex flex-column flex-grow-l-desk pl-md-0 pl-2 pt-md-0 pt-2">
  62.                                         <div class="font-12  pb-2 flex-grow-l-desk"> <a href="{{ path('sylius_shop_product_show', {'slug': associatedProduct.slug, '_locale': associatedProduct.translation.locale}) }}" title="{{ associatedProduct.name }}">{{ associatedProduct.name }} </a></div>
  63.                                         {% if not associatedProduct.variants.empty() %}
  64.                                             {% if associatedProduct|sylius_resolve_variant %}
  65.                                                 {% set variant = associatedProduct|sylius_resolve_variant %}
  66.                                                 <div class="d-flex align-items-center pt-1">
  67.                                                     <strong class="price-promo">{{ money.calculatePriceWithTax(variant, context) }} </strong>
  68.                                                     {% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
  69.                                                     {% if channelpricing.originalPrice > channelpricing.price  %}
  70.                                                         <span class="price-old ml-md-2 ml-3 pt-1">{{ money.calculateOriginalPriceWithTax(associatedProduct|sylius_resolve_variant, context) }}</span>
  71.                                                     {% endif %}
  72.                                                 </div>
  73.                                             {% endif %}
  74.                                         {% endif %}
  75.                                     </div>
  76.                                 </div>
  77.                             </div>
  78.                             {% endif %}
  79.                         {% endfor %}
  80.                     {% endif %}
  81.                 {% endfor %}
  82.             </div>
  83.         </div>
  84.     </div>
  85.     <div class="art-bg mt-0 page-article">
  86.         <div class="article-top">
  87.             <div class="contenuArticle">
  88.                 <div class="max-container-5 p-0">
  89.                     <div class="position-relative px-md-0 px-2">
  90.                         {% include '@SyliusShop/Product/Show/_breadcrumb.html.twig' %}
  91.                     </div>
  92.                     {% if configurator %}
  93.                         <div class="btn-back-wrap d-none">
  94.                             <span id="btn-back">
  95.                                 <span>Retour</span>
  96.                             </span>
  97.                         </div>
  98.                         <div class="products-bundles d-none justify-content-center"></div>
  99.                     {% endif %}
  100.                     <div id="art-detail" class="art-detail d-md-flex{% if configurator %} artconfig-bloc {% if advancedModel %} advanced-bloc{% endif %}{% endif %}" data-id="{{ product.id }}" data-add-product-visited-url="{{ path('app_shop_add_product_visited_ajax') }}">
  101.                         <div class="article-left">
  102.                            {{ sylius_template_event('sylius.shop.product.show.left_sidebar', _context) }}
  103.                             {% if configurator %}
  104.                                 <div class="sticky-bloc">
  105.                                     <div class="default-config-img hide" id="js-configurator">
  106.                                         {% include '@SyliusShop/Product/Show/Configurator/_configuratorWidget.html.twig' %}
  107.                                     </div>
  108.                                     <div class="tabpeso-conf p-0 pt-lg-3">
  109.                                     {{ sylius_template_event('sylius.shop.product.show.tab_details', _context) }}
  110.                                     </div>
  111.                                 </div>
  112.                            {% endif %}
  113.                         </div>
  114.                         <div class="article-right">
  115.                             <div class="max-art-desc">
  116.                                 {% if configurator %}
  117.                                     <div class="product-bundle-name title-article-art"></div>
  118.                                 {% endif %}
  119.                                     <div class="d-none d-md-block">
  120.                                         <div class="art-top-desc ">
  121.                                             <h1 id="sylius-product-name" {{ sylius_test_html_attribute('product-name', product.name) }} class="title-article-art">
  122.                                             {{ product.name }}
  123.                                             </h1>
  124.                                         </div>
  125.                                     </div>
  126.                                 {{ sylius_template_event('sylius.shop.product.show.right_sidebar', _context) }}
  127.                                 {% set slugPage_payment = app_get_slug_by_code_and_locale('secure_payment') %}
  128.                                 {% set slugPage_quick_expedition = app_get_slug_by_code_and_locale('quick_expedition') %}
  129.                                 <div class="av-article mt-1 pt-3 px-0">
  130.                                     <div class="row mx-xl-n2 mx-n1 justify-content-between">
  131.                                         <div class="col-lg  col-4 mb-4 mb-md-0 text-center px-xl-2 px-1">
  132.                                             <a href="{{ path('sylius_shop_contact_request') }}" class="box-av  text-center  {% if not configurator %}d-lg-flex align-items-center text-lg-left{% endif %}" title="{{'app.footer.reinsurance1'|trans|raw}}">
  133.                                                 <strong class=" d-block "><img src="{{asset('images/av1.svg')}}" alt=""></strong>
  134.                                                 <span class=" d-block {% if not configurator %}pl-md-2 pt-md-0{% endif %}">{{'app.footer.reinsurance1_br'|trans|raw}}</span>
  135.                                             </a>
  136.                                         </div>
  137.                                         <div class="col-lg col-4 mb-4 mb-md-0 text-center px-xl-2 px-1">
  138.                                             <a href="{% if slugPage_payment is not null  %}{{ path('bitbag_sylius_cms_plugin_shop_page_show', {'slug': slugPage_payment }) }}{% endif %}" class="box-av    text-center {% if not configurator %}d-lg-flex align-items-center text-lg-left{% endif %}" title="{{'app.footer.reinsurance2'|trans|raw}}">
  139.                                                 <strong class=" d-block"><img src="{{asset('images/av2.svg')}}" alt=""></strong>
  140.                                                 <span class=" d-block {% if not configurator %}pl-md-2pt-md-0{% endif %}">{{'app.footer.reinsurance2_br'|trans|raw}}</span>
  141.                                             </a>
  142.                                         </div>
  143.                                         <div class="col-lg col-4 mb-md-0 text-center px-xl-2 px-1">
  144.                                             <a href="{% if slugPage_quick_expedition is not null  %}{{ path('bitbag_sylius_cms_plugin_shop_page_show', {'slug': slugPage_quick_expedition }) }}{% endif %}" class="box-av text-center {% if not configurator %}d-lg-flex align-items-center text-lg-left{% endif %}" title="{{'app.footer.reinsurance4'|trans}}">
  145.                                                 <strong class=" d-block"><img src="{{asset('images/av4.svg')}}" alt=""></strong>
  146.                                                 <span class=" d-block {% if not configurator %}pl-md-2 pt-md-0{% endif %}">{{'app.footer.reinsurance4_br'|trans|raw}}</span>
  147.                                             </a>
  148.                                         </div>
  149.                                     </div>
  150.                                 </div>
  151.                             </div>
  152.                         </div>
  153.                     </div>
  154.                 </div>
  155.             </div>
  156.         </div>
  157.         <div class="max-container-3 p-0 mt-xl-3 pt-lg-3  {% if  configurator %} d-block d-md-none{% endif %}">
  158.             {{ sylius_template_event('sylius.shop.product.show.tab_details', _context) }}
  159.         </div>
  160.     </div>
  161.     <div class="article-bottom pt-md-5 pt-4 {% if  product.code !=  "test-t-shirt" %}mt-md-3 bg-light-site{% endif %}  pb-md-3 ">
  162.         <div class="max-container-4 px-0 px-0">
  163.             {{ sylius_template_event('sylius.shop.product.show.content', _context) }}
  164.         </div>
  165.     </div>
  166. {% endblock %}
  167. {% block javascripts %}
  168. {{ parent() }}
  169. {% include '@SyliusUi/_javascripts.html.twig' with {path: 'js/updateProductVariant.js'} %}
  170. {% include '@SyliusUi/_javascripts.html.twig' with {path: 'js/updateProduct.js'} %}
  171. <script>
  172.     $("body").on("click", '.qte-moins-art', function (event) {
  173.         var inputQuantity = $(this).closest('.sylius-quantity').find('input[type="number"]');
  174.         var currentVal = parseInt(inputQuantity.val());
  175.         if(currentVal > 1){
  176.             inputQuantity.val(currentVal - 1);
  177.             inputQuantity.trigger('change');
  178.         }
  179.     });
  180.     $("body").on("click", '.qte-plus-art', function (event) {
  181.         var inputQuantity = $(this).closest('.sylius-quantity').find('input[type="number"]');
  182.         var currentVal = parseInt(inputQuantity.val());
  183.         inputQuantity.val(currentVal + 1);
  184.         inputQuantity.trigger('change');
  185.     });
  186.     {# add this product to customer's products visited (in database) #}
  187.     let customerId = {{ app.user ? app.user.customer.id : 0 }};
  188.     let divData = document.getElementById('art-detail');
  189.     if (divData) {
  190.         let data = {productId: divData.dataset.id, customerId: customerId}
  191.         $.ajax({
  192.             type: 'POST',
  193.             url: divData.dataset.addProductVisitedUrl,
  194.             data: data,
  195.             success(response) {
  196.             },
  197.             error() {
  198.             }
  199.         });
  200.     }
  201. </script>
  202. {% endblock %}