{% 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 %}{{ parent() }}{% endif %}{% endblock %}
{% block metatags %}
{% if taxon is defined and taxon.translation.metaDescription is not null %}
<meta name="description" content="{{ taxon.translation.metaDescription }}">
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block content %}
<div class="page-categorie-content">
<div class="categorie-top position-relative zindex-1">
<div class="object-img-categ">
{% if taxon.images|length > 1 %}
{% set path = taxon.images[1].path|imagine_filter(filter|default('app_taxon_image_large_thumbnail')) %}
{% else %}
{% set path = asset('images/img_categ.jpg') %}
{% endif %}
<img src="{{ path }}" alt="{{ taxon.name }}" class="" />
</div>
<div class="categorie-img max-container-5 px-0">
<div class="px-md-0 px-2 position-relative zindex-3">
{{ render(url('sylius_shop_partial_taxon_show_by_slug', {'slug': app.request.attributes.get('slug'),'template': '@SyliusShop/Taxon/_breadcrumb.html.twig'})) }}
</div>
<div class="absolute-categ text-center">
<h1 class="title-categ">{{ taxon.name }}</h1>
<div class="fontsize-normal text-grey max-line-3 pt-2">{{ taxon.translation.description|raw }}</div>
</div>
</div>
</div>
<div class="max-container-5 px-0">
<div class="categorie-bottom">
{% if result.count == 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-center ">
<div class="d-inline-block">
<div class="alert alert-danger">
{{ 'app.common.aucun_produit_disponible'|trans }}
</div>
</div>
</div>
</div>
{% else %}
<div class=" mt-perso-vh">
<div class="filtre-cat bg-gradient-orange">
<div class="categorie-filtre mbiz-sylius-search-filters">
<div class="lib-f-c fontsize-mobile-text">
<span class="d-block">{{'app.taxon.filter_by'|trans}} </span>
</div>
<div class="d-md-none d-block mobile-label-filtre bg-gradient-orange bg-gradient-hover text-uppercase">{{'sylius.ui.filters'|trans}} <i class="icon-up-open-big"></i></div>
<div class="cell-facette">
<span class="close-filtre-categ d-block d-md-none bg-gradient-orange"><img src="{{ asset('images/closemenu.png')}}" alt="X" class="d-block" /></span>
<div class="content-fitre-categ align-items-center justify-content-center">
{% include '@MonsieurBizSyliusSearchPlugin/Search/_sidebar.html.twig' %}
</div>
</div>
</div>
</div>
</div>
<div class="res-filtre fontsize-mobile-text pb-md-0 pb-2 d-none d-md-block pt-md-3 px-lg-0 px-3">
</div>
<div class="liste-articles pt-md-4 pt-2 pb-md-4 pb-2 mt-xl-2 px-lg-0 px-3">
<div class="row mx-n2 mx-n3 mx-lg-n3p mx-xs-n2" 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-lg-3 col-md-4 col-sm-6 col-12 px-3 mb-md-3 mb-4 px-lg-3p mb-lg-5p px-xs-2">
{% set product = product_repository.find(item.id) %}
{% include '@SyliusShop/Product/_box.html.twig' with {'product': product} 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-lg-3 col-md-4 col-sm-6 col-12 px-3 mb-md-3 mb-4 px-lg-3p mb-lg-5p px-xs-2 article-usefull">
{% include '@SyliusShop/Product/_box.html.twig' with {'product': productUsefull} 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-lg-3 col-md-4 col-sm-6 col-12 px-3 mb-md-3 mb-4 px-lg-3p mb-lg-5p px-xs-2 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>
<div class="text-center max-container-5 px-0">
<div class="fontsize-normal text-grey max-line-3 pt-2">{{ taxon.translation.textSEO|raw }}</div>
</div>
</div>
</div>
{% endblock %}