templates/elements/pagesElements/products/_product.html.twig line 1

Open in your IDE?
  1. {% set translated = product|translate %}
  2. {% set promotion = product.inPromotion %}
  3. {# {% dump(product) %} #}
  4. {% if noColumn is defined %}
  5. <div style="{{ customStyle | default("") }}">
  6.     {% else %}
  7.     <div class="{{ column ?? "col-lg-3" }} col-md-6 col-sm-6 mb-3">
  8.         {% endif %}
  9.         <figure class="card card-product-grid mb-0 h-100">
  10.             <a href="{{ path("product_detail", {id: product.id, brand: product.brand.name | urlSanitizer, slug: translated.slug}) }}">
  11.                 <div class="img-wrap position-relative" style="">
  12.                     <img
  13.                             src="{{ vich_uploader_asset(translated) | imagine_filter('product_list_thumb') }}"
  14.                             alt="{{ product.name }}"
  15.                             class="img-fluid product-image"
  16.                     >
  17.                     {% if promotion %}
  18.                         <div class="product-promotion">
  19.                             - {{ calculPromotionPercent(product) }}%
  20.                         </div>
  21.                     {% endif %}
  22.                 </div>
  23.             </a>
  24.             <figcaption class="info-wrap border-top d-flex flex-column justify-content-between" style="height: 50%">
  25.                 <div>
  26.                     <p class="title mb-2 fw-bold text-center">{{ translated.name }}</p>
  27.                     <div class="price-wrap text-center">
  28.                         {% if promotion %}
  29.                             <span class="price text-decoration-line-through"
  30.                                   id="normal-price">{{ product.price | number_format(2) }} CHF</span>
  31.                             <span class="price text-primary ms-3"
  32.                                   id="promotional-price">{{ product.priceWithPromotion | number_format(2) }} CHF</span>
  33.                         {% else %}
  34.                             <span class="price text-primary"
  35.                                   id="promotional-price">{{ product.price | number_format(2) }} CHF</span>
  36.                         {% endif %}
  37.                     </div>
  38.                 </div>
  39.                 <div class="text-center mt-3">
  40.                     {{ include('elements/pagesElements/products/_product_add_cart_btn.html.twig', {product: product}) }}
  41.                 </div>
  42.             </figcaption>
  43.         </figure>
  44.     </div>