templates/default/produit.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. {# ░░░ BREADCRUMB ░░░ #}
  6. <nav class="small mb-3 container" aria-label="breadcrumb">
  7.     <ol class="breadcrumb mb-0">
  8.         <li class="breadcrumb-item"><a href="{{ path('home') }}">Accueil</a></li>
  9.         {% for crumb in breadcrumbs %}
  10.             <li class="breadcrumb-item"><a href="{{ crumb.url }}">{{ crumb.label }}</a></li>
  11.         {% endfor %}
  12.         <li class="breadcrumb-item active" aria-current="page">{{ product.name }}</li>
  13.     </ol>
  14. </nav>
  15. {# ░░░ PRODUCT MAIN ░░░ #}
  16. <section class="pb-5">
  17.     <div class="container">
  18.         <div class="row g-5">
  19.             {# ——— IMAGES ——— #}
  20.             <div class="col-md-5">
  21.                 <div class="ratio ratio-1x1 border rounded overflow-hidden mb-3">
  22.                     <img src="{{ asset(product.mainImage) }}" class="img-fluid object-fit-cover" alt="{{ product.name }} image principale">
  23.                 </div>
  24.                 {# thumbnails #}
  25.                 <div class="d-flex gap-2 flex-wrap">
  26.                     {% for img in product.gallery %}
  27.                         <a href="#" class="d-block ratio ratio-1x1 thumb border rounded overflow-hidden" style="width:72px;">
  28.                             <img src="{{ asset(img) }}" class="img-fluid object-fit-cover" alt="thumb">
  29.                         </a>
  30.                     {% endfor %}
  31.                 </div>
  32.             </div>
  33.             {# ——— DETAILS ——— #}
  34.             <div class="col-md-7">
  35.                 <h1 class="h3 fw-bold text-acti-blue">{{ product.name }}</h1>
  36.                 <p class="small text-muted mb-1">Référence {{ product.sku }}</p>
  37.                 <div class="mb-4 lh-sm" style="max-width:500px;">
  38.                     {{ product.description|raw }}
  39.                 </div>
  40.                 <form action="{#{ path('app_cart_add', { id: product.id }) }#}" method="post" class="product-form">
  41.                     <div class="row g-3 mb-4" style="max-width:320px;">
  42.                         <div class="col-6">
  43.                             <label for="size" class="form-label small">Taille :</label>
  44.                             <select name="size" id="size" class="form-select form-select-sm" required>
  45.                                 {% for size in product.sizes %}
  46.                                     <option value="{{ size }}">{{ size }}</option>
  47.                                 {% endfor %}
  48.                             </select>
  49.                         </div>
  50.                         <div class="col-6">
  51.                             <label for="qty" class="form-label small">Quantité</label>
  52.                             <input type="number" name="qty" id="qty" class="form-control form-control-sm" value="1" min="1" style="max-width:80px;">
  53.                         </div>
  54.                     </div>
  55.                     <button type="submit" class="btn btn-primary px-4">Ajouter au panier</button>
  56.                 </form>
  57.             </div>
  58.         </div>
  59.     </div>
  60. </section>
  61. {# ░░░ RELATED PRODUCTS ░░░ #}
  62. <section class="py-5 bg-light">
  63.     <div class="container">
  64.         <h2 class="h5 fw-bold text-acti-blue mb-4">Produits liés à cet article</h2>
  65.         <div class="row row-cols-2 row-cols-md-4 g-4">
  66.             {% for p in related %}
  67.                 <div class="col">
  68.                     <div class="card h-100 border-0 product-card">
  69.                         <a href="{#{ path('app_product_show', { slug:p.slug }) }#}" class="ratio ratio-1x1">
  70.                             <img src="{{ asset(p.mainImage) }}" class="img-fluid object-fit-cover" alt="{{ p.name }}">
  71.                         </a>
  72.                         <div class="card-body p-0 pt-2">
  73.                             <h6 class="small fw-bold mb-1 text-dark">{{ p.name }}</h6>
  74.                             <p class="small text-muted mb-1">{{ p.description }}</p>
  75.                             <p class="fw-bold mb-0">{{ p.price|number_format(2, ',', ' ') }} €</p>
  76.                         </div>
  77.                     </div>
  78.                 </div>
  79.             {% endfor %}
  80.         </div>
  81.         <div class="text-center mt-4">
  82.             <a href="{#{ path('app_new_products') }#}" class="small text-acti-blue text-decoration-underline">Voir les nouveaux produits</a>
  83.         </div>
  84.     </div>
  85. </section>
  86. <!-- ░░░ FOOTER ░░░ -->
  87.   {{include('section/footer.html.twig')}}
  88. {% endblock %}