{% extends '@SyliusShop/layout.html.twig' %}
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}
{% block title %}
{% if taxon is defined and taxon.translation.metaTitle is not null %}
{{ taxon.translation.metaTitle }}
{% else %}
{% if app_get_page_meta_by_code("taxon",{ 'taxon': taxon }) is not empty %}
{% set meta = app_get_page_meta_by_code("taxon", { 'taxon': taxon }) %}
{% if meta.title is not null %}
{{ meta.title }}
{% else %}
{{ parent() }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endif %}
{% endblock %}
{% block metatags %}
{% if taxon is defined and taxon.translation.metaDescription is not null %}
<meta name="description" content="{{ taxon.translation.metaDescription }}">
{% else %}
{% if app_get_page_meta_by_code("taxon", { 'taxon': taxon}) is not empty %}
{% set meta = app_get_page_meta_by_code("taxon", { 'taxon': taxon }) %}
{% if meta.metaDescription is not null %}
<meta name="description" content="{{ meta.metaDescription }}">
{% else %}
{{ parent() }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endif %}
{% if taxon.translation.metaRobotIndex == true %}
{% set metaRobotIndex = 'index, follow' %}
{% elseif taxon.translation.metaRobotIndex == false %}
{% set metaRobotIndex = 'noindex, nofollow' %}
{% endif %}
{% if metaRobotIndex is defined %}
<meta name="robots" content="{{ metaRobotIndex }}"/>
{% endif %}
{% endblock %}
{% block content %}
{% set wishlist = null %}
{% if app.user %}
{% set wishlist = app_get_wishlist() %}
{% endif %}
<section class="container px-xl-0 px-2">
<section class="container-page-aside pb-2">
<div class="">
{{ render(url('sylius_shop_partial_taxon_show_by_slug', {'slug': app.request.attributes.get('slug'),'template': '@SyliusShop/Taxon/_breadcrumb.html.twig'})) }}
</div>
<div class="bg-white rounded-10 border p-xl-4 p-3 mb-4 page-categorie-content">
<div class="categorie-top pb-2 gradient-whiteb avenir-book pr-xl-5 pr-4">
<h1 class="title-big text-left has-after pb-3">{{ taxon.name }}</h1>
<div class="expand-me font-15 font-16-mobile">
{{ taxon.translation.description|raw }}
</div>
</div>
{% if taxon.children|length > 0 %}
<div class="pt-3 sscategorie-container font-16-mobile {% if taxon.children|length < 20 %} max-container-txt {% endif %}">
<ul class="row no-gutters pl-3 ">
{% for childTaxon in taxon.children %}
<li class="col-12 pr-md-3 {% if taxon.children|length < 20 %}col-md-6 {% else %} col-lg-4 col-md-6 {% endif %}"><a href="{{ path('monsieurbiz_sylius_search_taxon', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale}) }}" title="{{ childTaxon.name }}">{{ childTaxon.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if result.count == 0 %}
<div class="categorie-bottom px-lg-0">
<div class="no-result pt-md-4 pt-2 pb-md-4 pb-2 mt-xl-2 px-lg-0 px-3">
<div class="py-4 my-3 text-left ">
<div class="d-inline-block">
<div class="alert alert-danger">
{{ 'app.common.no_product_available'|trans }}
</div>
</div>
</div>
</div>
</div>
{% else %}
<div class="pb-3">
<div class="filtre-cat mt-3">
<div class="categorie-filtre mbiz-sylius-search-filters row no-gutters align-items-center">
<div class="lib-f-c font-weight-bold font-16 pr-xl-5 pr-3 col-auto">
<span class="d-block pb-2">Trier par :</span>
</div>
<div class="d-lg-none d-block py-3 text-center ">
<div class="d-inline-block mobile-label-filtre">
<span class="d-flex align-items-center">
<svg class="burger-icon" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="burger" stroke="none" stroke-width="0" fill="#fff" fill-rule="evenodd">
<g id="group-desktop" fill-rule="nonzero">
<path d="M5,7.625 L25,7.625" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M5,15.125 L25,15.125" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M5,22.625 L25,22.625" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</svg>
<strong class="">{{'app.taxon.sort_by'|trans}}</strong>
</span>
</div>
</div>
<div class="cell-facette col">
<div class="d-flex justify-content-between d-lg-none align-items-center p-3 border-bottom">
<strong class="font-20 text-uppercase">{{'app.taxon.refine_your_choice'|trans}}</strong>
<span class="close-filtre-categ "><img src="{{asset('images/closemenu.png')}}" alt="X" class="d-block" /></span>
</div>
<div class="content-fitre-categ align-items-center justify-content-center">
{% include '@MonsieurBizSyliusSearchPlugin/Search/_sidebar.html.twig' %}
</div>
</div>
</div>
</div>
<div class="res-filtre fontsize-mobile-text pb-md-0 pb-2 ">
<div class="row no-gutters align-items-center justify-content-between">
<div class="col ">
<span class="d-inline-block font-16">{{'app.taxon.your_selection'|trans}} :</span>
<div class="d-inline-block">
{% for filter in result.filters %}
{% for value in filter.values %}
{% if value.isApplied and filter.type != "range" %}
<span class="filtre delete-filter" data-filter="{{ 'filter-' ~ filter.code ~ '-value-' ~ value.slug }}" ><i class="icon-cancel"></i><span>{{ value.label}} </span></span>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
<div class="col-auto">
{{result.count}} {{'app.taxon.items'|trans}}
</div>
</div>
</div>
</div>
<div class="categorie-bottom px-lg-0">
<div class="py-4">
<div class="row justify-content-between no-gutters px-xl-0 px-lg-2 px-0">
<div class="col-auto pr-1">{% include '@MonsieurBizSyliusSearchPlugin/Search/_pagination.html.twig' %}</div>
<div class="col-auto pl-1">{% include '@MonsieurBizSyliusSearchPlugin/Search/_sorting.html.twig' %}</div>
</div>
</div>
<div class="row no-gutters mx-n3" id="products">
{% set productsUsefullNbr = taxon.productsUsefull.count %}
{% set productsNbr = result.count %}
{% if productsUsefullNbr == 1 %}
{% set productUsefullPos = (productsNbr / 2)|round %}
{% elseif productsUsefullNbr > 0 %}
{% set productUsefullPos = (productsNbr / productsUsefullNbr)|round %}
{% endif %}
{% set i = 0 %}
{% set itemNum = 0 %}
{% for item in result %}
{% set itemNum = itemNum + 1 %}
<div class="col-5-desk col-lg-3 col-md-4 col-6 mb-lg-5 mb-4">
{% set product = product_repository.find(item.id) %}
{% include '@SyliusShop/Product/_box.html.twig' with {'product': product, 'wishlist': wishlist} only %}
</div>
{% if productsUsefullNbr > 0 and i < productsUsefullNbr %}
{% if itemNum == productUsefullPos %}
{% for itemUsefull in taxon.productsUsefull|slice(i, i + 1) %}
{% set productUsefull = product_repository.find(itemUsefull.id) %}
{% if productUsefull.enabled %}
<div class="col-5-desk col-lg-3 col-md-4 col-6 mb-lg-5 mb-4 article-usefull">
{% include '@SyliusShop/Product/_box.html.twig' with {'product': productUsefull, 'wishlist': wishlist} only %}
</div>
{% endif %}
{% set i = i + 1 %}
{% endfor %}
{% set itemNum = 0 %}
{% endif %}
{% endif %}
{% endfor %}
{% if productsUsefullNbr > 0 and i < productsUsefullNbr %}
{% for itemUsefull in taxon.productsUsefull|slice(i, i + 1) %}
{% set productUsefull = product_repository.find(itemUsefull.id) %}
{% if productUsefull.enabled %}
<div class="col-5-desk col-lg-3 col-md-4 col-6 mb-lg-5 mb-4 article-usefull">
{% include '@SyliusShop/Product/_box.html.twig' with {'product': productUsefull} only %}
</div>
{% endif %}
{% set i = i + 1 %}
{% endfor %}
{% endif %}
</div>
{{ pagination.simple(result.paginator) }}
</div>
{% endif %}
</div>
{% if taxon.translation.textSeo is defined %}
<div class="text-grey font-15 py-lg-4 py-3 d-none d-md-block">
{{ taxon.translation.textSeo|raw }}
</div>
{% endif %}
</section>
</section>
{% endblock %}