templates/main/content/_short_product.html.twig line 1

Open in your IDE?
  1. <a href="{{ path('produits-entretien-show', {'id':product.id }) }}">
  2.     <div class="product row fond-white border-gray-200 mb-10 pa-10 pb-20 pt-20">
  3.         <div class="medium-w-25">
  4.             {# MAIN IMAGE or NOT #}
  5.             {% set mainImage = false %}
  6.             {% for image in product.productImages %}
  7.                 {% if image.isMain and mainImage == false %}
  8.                         <img class="fl mr-2" src="{{ asset('/upload/products/' ~ product.id ~ '/' ~ image.name) }}" alt="image" width="200">
  9.                     {% set mainImage = true %}
  10.                 {% endif %}
  11.             {% endfor %}
  12.             {% if not mainImage %}
  13.                 <img class="fl" src="{{ asset('/upload/products/no_main_image.png') }}" title="aucune image pour ce produit"  alt="aucune image pour ce produit" width="200">
  14.             {% endif %}
  15.             {# nb images de galeries (exceptĂ© main image #}
  16.             {% set countImages = product.productImages|length %}
  17.             {% if mainImage %} {# on enlève la main image au compteur #}
  18.                 {% set countImages = countImages - 1 %}
  19.             {% endif %}
  20.             {# GALERIES D'IMAGES > 2 thumbs max + nb images suppl. #}
  21.             {% set g = 0 %}
  22.             {% for image in product.productImages %}
  23.                 {% if not image.isMain and g < 2 %}
  24.                     <img class="fl mr-2 mb-2" src="{{ asset('/upload/products/' ~ product.id ~ '/' ~ image.name) }}" alt="image" width="50">
  25.                     {% set g = g + 1 %}
  26.                 {% endif %}
  27.             {% endfor %}
  28.             {% if countImages > 2 %}
  29.                 {% set moreImages = countImages - 2 %}
  30.                 <div class="fl mr-2 mb-2 width-50 height-40 fond-gray-900 typo-white text-center pt-7">+ {{ moreImages }}</div>
  31.             {% endif %}
  32.         </div>
  33.         <div class="medium-w-75">
  34.             <div class="fr">
  35.                 {% if product.action | length > 0 %}
  36.                     {% for action in product.action %}
  37.                         <span class="badge badge-gray-900 typo-60 majuscule rounded-pill pr-5">{{ action.name }}</span>
  38.                     {% endfor %}
  39.                 {% endif %}
  40.                 {% if product.category | length > 0 %}
  41.                     {% for category in product.category %}
  42.                         <span class="badge badge-perso-bleu-clair typo-60 majuscule rounded-pill pr-5">{{ category.name }}</span>
  43.                     {% endfor %}
  44.                 {% endif %}
  45.             </div>
  46.             <h2 class="typo-150 mt-30 mb-10">{{ product.title }}</h2>
  47.             {% if product.shortContent %}
  48.                 <h3>{{ product.shortContent }}</h3>
  49.             {% else %}
  50.                 <h3>{{ product.subtitle }}</h3>
  51.             {% endif %}
  52.         </div>
  53.     </div>
  54. </a>