templates/default/category.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block body %}
  3. <!-- ░░░ Navigation ░░░ -->
  4.   {{include('section/nav.html.twig')}}
  5. <section class="cat-hero position-relative">
  6.     <img src="{{ asset('img/bg/bg-category.png') }}" class="img-fluid w-100" alt="{#{ category.name }#} banner">
  7.     <div class="cat-hero-caption position-absolute start-0 bottom-0 p-4">
  8.         <h1 class="h4 text-white fw-bold mb-1">{#{ category.name }#}</h1>
  9.         <p class="small text-white mb-0">Découvrez notre sélection 2025</p>
  10.     </div>
  11. </section>
  12. {# ░░░ MAIN CONTENT ░░░ #}
  13. <section class="py-5">
  14.     <div class="container">
  15.         <div class="row g-5">
  16.             {# ——— LEFT SIDEBAR ——— #}
  17.             <aside class="col-md-3">
  18.                 <!-- sous-categories -->
  19.                 <h6 class="fw-bold text-uppercase small mb-3">{{ parentCategory.name|default('Équipements et accessoires') }}</h6>
  20.                 <ul class="list-unstyled small mb-5">
  21.                    {% for sub in subcategories %}
  22.                         <li class="mb-1">
  23.                             <a href="{#{ path('app_category_show', { slug: sub.slug }) }}" class="text-decoration-none {{ sub.id==category.id ? 'fw-bold text-acti-blue' }#}">
  24.                                 {{ sub.name }}
  25.                             </a>
  26.                         </li>
  27.                     {% endfor %}
  28.                 </ul>
  29.                 <!-- marques -->
  30.                 <h6 class="fw-bold text-uppercase small mb-3">Les marques</h6>
  31.                 <form method="get" class="brand-filter">
  32.                    {#{% for brand in brands %}
  33.                         <div class="form-check mb-1">
  34.                             <input class="form-check-input" type="checkbox" name="brand[]" value="{{ brand.slug }}" id="b{{ loop.index }}" {{ brand.selected ? 'checked' }}>
  35.                             <label class="form-check-label small" for="b{{ loop.index }}">{{ brand.name }}</label>
  36.                         </div>
  37.                     {% endfor %} #} 
  38.                     <button type="submit" class="btn btn-outline-secondary btn-sm mt-2">Filtrer</button>
  39.                 </form>
  40.             </aside>
  41.             {# ——— RIGHT CONTENT ——— #}
  42.             <div class="col-md-9">
  43.                 <div class="d-flex justify-content-end mb-3">
  44.                     <form method="get" class="ms-auto d-flex align-items-center gap-2">
  45.                         <label class="small mb-0" for="sort">Trier</label>
  46.                         <select name="sort" id="sort" class="form-select form-select-sm" style="max-width:160px;">
  47.                           {# <option value="popularity" {% if sort=='popularity' %}selected{% endif %}>Popularité</option>
  48.                             <option value="price_asc" {% if sort=='price_asc' %}selected{% endif %}>Prix croissant</option>
  49.                             <option value="price_desc" {% if sort=='price_desc' %}selected{% endif %}>Prix décroissant</option>
  50.                             <option value="new" {% if sort=='new' %}selected{% endif %}>Nouveautés</option> #} 
  51.                         </select>
  52.                     </form>
  53.                 </div>
  54.                 <!-- grille produits -->
  55.                 <div class="row row-cols-2 row-cols-md-3 g-4">
  56.                     {% for product in products %}
  57.                         <div class="col">
  58.                             <div class="card h-100 product-card border-0">
  59.                                 <a href="{{ path('produit', { slug: product.slug }) }}" class="ratio ratio-1x1">
  60.                                     <img src="{{ asset(product.image) }}" class="img-fluid object-fit-cover" alt="{{ product.name }}">
  61.                                 </a>
  62.                                 <div class="card-body px-0">
  63.                                     <h6 class="card-title small mb-1 fw-bold text-dark">{{ product.name }}</h6>
  64.                                     <p class="card-text small text-muted mb-1">{{ product.shortDescription }}</p>
  65.                                     <p class="fw-bold mb-0">{{ product.price|number_format(2, ',', ' ') }} €</p>
  66.                                 </div>
  67.                             </div>
  68.                         </div>
  69.                     {% endfor %}
  70.                 </div>
  71.                 {# pagination #}
  72.                 {% if pagination is defined %}
  73.                     <div class="mt-4">
  74.                         {#{ knp_pagination_render(pagination) }#}
  75.                     </div>
  76.                 {% endif %}
  77.             </div>
  78.         </div>
  79.     </div>
  80. </section>
  81. <!-- ░░░ MARQUES ░░░ -->
  82.   {{include('section/marque.html.twig')}}
  83. <!-- ░░░ FOOTER ░░░ -->
  84.   {{include('section/footer.html.twig')}}
  85. {% endblock %}