{% set block = app_get_blocks('num_telephone', sylius.channel.code ) %}
{% set block_h = app_get_blocks('horaires_magasin', sylius.channel.code ) %}
{% set block_livr = app_get_blocks('imageperso_index', sylius.channel.code ) %}
{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set context = {"channel": sylius.channel} %}
{% extends '@SyliusShop/layout.html.twig' %}
{% block title %}
{% include '@DediSyliusSEOPlugin/Shop/Header/_title.html.twig' with { 'resource': product ?? sylius.channel } %}
{% endblock %}
{% block metatags %}
{% if product.metaKeywords is not empty %}
<meta name="keywords" content="{{ product.metaKeywords }}" />
{% endif %}
{{ sylius_template_event('dedi_sylius_seo_plugin.metatags', { resource: product ?? sylius.channel }) }}
{{ sylius_template_event('dedi_sylius_seo_plugin.rich_snippets') }}
{% endblock %}
{% block content %}
{{ encore_entry_script_tags('fabric', null, 'bootstrapTheme') }}
{{ encore_entry_script_tags('configurator', null, 'bootstrapTheme') }}
{{ render(url('app_shop_geolocalisation')) }}
{% set configurator = false %}
{% set advancedModel = false %}
{% if product.isBundle and product.productBundle %}
{% for productBundleItem in product.productBundle.productBundleItems %}
{% if productBundleItem.productVariant.model %}
{% set configurator = true %}
{% if productBundleItem.productVariant.model.advanced %}
{% set advancedModel = true %}
{% endif %}
{% endif %}
{% endfor %}
{% elseif product.variants|length > 0 %}
{% for variant in product.variants %}
{% if variant.model %}
{% set configurator = true %}
{% if variant.model.advanced %}
{% set advancedModel = true %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
<div class="hide-cross-page">
<div id="cross-selling-add-to-cart" class="pt-3">
<div class="row pt-2 mx-md-n3 mx-0">
{% for association in product.associations %}
{% if association.getType().getCode() == "cross_selling_add_to_cart" and association.associatedProducts|length > 0 %}
<div class="modal-title titre-popup color-purple-s title-popup-cross-selling">{{'app.product.pour_completer'|trans}}</div>
{% for associatedProduct in association.associatedProducts %}
{% if associatedProduct.enabled %}
{% set variant = associatedProduct|sylius_resolve_variant %}
<div class="col-md-4 col-12 border-bottom-mob px-md-3 px-0 mx-md-0 mx-2 mb-4">
<div class="row no-gutters h-100">
<div class="col-md-12 col-sm-3 col-5 max-height-1 pr-md-0 pr-1">
{% if associatedProduct.images|first %}
{% set path = associatedProduct.getImagesByPosition|first.path|imagine_filter(filter|default('sylius_shop_product_thumbnail')) %}
{% else %}
{% set path = asset('images/spacer.png') %}
{% endif %}
<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>
</div>
<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">
<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>
{% if not associatedProduct.variants.empty() %}
{% if associatedProduct|sylius_resolve_variant %}
{% set variant = associatedProduct|sylius_resolve_variant %}
<div class="d-flex align-items-center pt-1">
<strong class="price-promo">{{ money.calculatePriceWithTax(variant, context) }} </strong>
{% set channelpricing = variant.getChannelPricingForChannel(sylius.channel) %}
{% if channelpricing.originalPrice > channelpricing.price %}
<span class="price-old ml-md-2 ml-3 pt-1">{{ money.calculateOriginalPriceWithTax(associatedProduct|sylius_resolve_variant, context) }}</span>
{% endif %}
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
<div class="art-bg mt-0 page-article">
<div class="article-top">
<div class="contenuArticle">
<div class="max-container-5 p-0">
<div class="position-relative px-md-0 px-2">
{% include '@SyliusShop/Product/Show/_breadcrumb.html.twig' %}
</div>
{% if configurator %}
<div class="btn-back-wrap d-none">
<span id="btn-back">
<span>Retour</span>
</span>
</div>
<div class="products-bundles d-none justify-content-center"></div>
{% endif %}
<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') }}">
<div class="article-left">
{{ sylius_template_event('sylius.shop.product.show.left_sidebar', _context) }}
{% if configurator %}
<div class="sticky-bloc">
<div class="default-config-img hide" id="js-configurator">
{% include '@SyliusShop/Product/Show/Configurator/_configuratorWidget.html.twig' %}
</div>
<div class="tabpeso-conf p-0 pt-lg-3">
{{ sylius_template_event('sylius.shop.product.show.tab_details', _context) }}
</div>
</div>
{% endif %}
</div>
<div class="article-right">
<div class="max-art-desc">
{% if configurator %}
<div class="product-bundle-name title-article-art"></div>
{% endif %}
<div class="d-none d-md-block">
<div class="art-top-desc ">
<h1 id="sylius-product-name" {{ sylius_test_html_attribute('product-name', product.name) }} class="title-article-art">
{{ product.name }}
</h1>
</div>
</div>
{{ sylius_template_event('sylius.shop.product.show.right_sidebar', _context) }}
{% set slugPage_payment = app_get_slug_by_code_and_locale('secure_payment') %}
{% set slugPage_quick_expedition = app_get_slug_by_code_and_locale('quick_expedition') %}
<div class="av-article mt-1 pt-3 px-0">
<div class="row mx-xl-n2 mx-n1 justify-content-between">
<div class="col-lg col-4 mb-4 mb-md-0 text-center px-xl-2 px-1">
<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}}">
<strong class=" d-block "><img src="{{asset('images/av1.svg')}}" alt=""></strong>
<span class=" d-block {% if not configurator %}pl-md-2 pt-md-0{% endif %}">{{'app.footer.reinsurance1_br'|trans|raw}}</span>
</a>
</div>
<div class="col-lg col-4 mb-4 mb-md-0 text-center px-xl-2 px-1">
<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}}">
<strong class=" d-block"><img src="{{asset('images/av2.svg')}}" alt=""></strong>
<span class=" d-block {% if not configurator %}pl-md-2pt-md-0{% endif %}">{{'app.footer.reinsurance2_br'|trans|raw}}</span>
</a>
</div>
<div class="col-lg col-4 mb-md-0 text-center px-xl-2 px-1">
<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}}">
<strong class=" d-block"><img src="{{asset('images/av4.svg')}}" alt=""></strong>
<span class=" d-block {% if not configurator %}pl-md-2 pt-md-0{% endif %}">{{'app.footer.reinsurance4_br'|trans|raw}}</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="max-container-3 p-0 mt-xl-3 pt-lg-3 {% if configurator %} d-block d-md-none{% endif %}">
{{ sylius_template_event('sylius.shop.product.show.tab_details', _context) }}
</div>
</div>
<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 ">
<div class="max-container-4 px-0 px-0">
{{ sylius_template_event('sylius.shop.product.show.content', _context) }}
</div>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% include '@SyliusUi/_javascripts.html.twig' with {path: 'js/updateProductVariant.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {path: 'js/updateProduct.js'} %}
<script>
$("body").on("click", '.qte-moins-art', function (event) {
var inputQuantity = $(this).closest('.sylius-quantity').find('input[type="number"]');
var currentVal = parseInt(inputQuantity.val());
if(currentVal > 1){
inputQuantity.val(currentVal - 1);
inputQuantity.trigger('change');
}
});
$("body").on("click", '.qte-plus-art', function (event) {
var inputQuantity = $(this).closest('.sylius-quantity').find('input[type="number"]');
var currentVal = parseInt(inputQuantity.val());
inputQuantity.val(currentVal + 1);
inputQuantity.trigger('change');
});
{# add this product to customer's products visited (in database) #}
let customerId = {{ app.user ? app.user.customer.id : 0 }};
let divData = document.getElementById('art-detail');
if (divData) {
let data = {productId: divData.dataset.id, customerId: customerId}
$.ajax({
type: 'POST',
url: divData.dataset.addProductVisitedUrl,
data: data,
success(response) {
},
error() {
}
});
}
</script>
{% endblock %}