templates/main/home/_article.html.twig line 1

Open in your IDE?
  1. <div class="product product-2">
  2.     <figure class="product-media">
  3.         {% if item.quantity <= 0 %}
  4.             <span class="product-label label-out bg-danger">{{'Out of Stock'|trans}}</span>
  5.         {% else %}
  6.         {% import "macros/etats.html.twig" as etats %}
  7.         {{ etats.articleLabel(item.label) }}
  8.                 {% if item.reduction > 0 %}
  9.             <span class="product-label mt-3 label-circle label-out bg-danger">-{{ item.reduction}}%</span>
  10.         {% endif %}        
  11.         {% endif %}
  12.         <a 
  13.         href="{{ path('articles_show', { category: item.category.slug, slug: item.slug, id: item.id}) }}">
  14.         {% for item in item.images|slice(0,1) %}
  15.             <img class="product-image" src="{{ asset('img/article/' ~ item.name ) }}" alt="{{ item.name }}">
  16.         {% else %}
  17.             <img src="{{ asset('img/vide.png')}}" alt="Product image" class="product-image">
  18.         {% endfor %}
  19.         </a>
  20.         <div class="product-action-vertical">
  21.             {% if app.user %}
  22.                 {% if not isToFavoris(app.user, item) %}
  23.                     <a href="{{ path('favoris_add',{id:item.id}) }}" data-id="{{ item.id }}" class="btn-product-icon btn-wishlist js-favoris js-add-favoris btn-expandable">
  24.                         <span>{{'add to wishlist'|trans}}</span>
  25.                     </a>
  26.                 {% else %}
  27.                     <a href="{{ path('favoris_remove',{id:item.id}) }}" data-id="{{ item.id }}" class="btn-product-icon btn-wishlist js-favoris  bg-danger js-remove-favoris btn-expandable">
  28.                         <span class="bg-danger text-white">{{'remove to wishlist'|trans}}</span>
  29.                     </a>
  30.                 {% endif %}
  31.             {% else %}
  32.                 <a href="#" class="btn-product-icon btn-wishlist js-favoris-login btn-expandable">
  33.                     <span>{{'add to wishlist'|trans}}</span>
  34.                 </a>
  35.             {% endif %}
  36.         </div>
  37.         <!-- End .product-action -->
  38.         {% if item.quantity > 0 %}
  39.         <div class="product-action product-action-dark">
  40.                 <a href="{{ path('cart_add',{ id: item.id }) }}" class="btn-product js-btn-add btn-cart" data-id="{{item.id}}">
  41.                     <span>{{'add to cart'|trans}}</span>
  42.                 </a>
  43.         </div>
  44.         {% endif %}
  45.             
  46.         <!-- End .product-action -->
  47.     </figure>
  48.     <!-- End .product-media -->
  49.     <div class="product-body">
  50.         <div class="product-cat">
  51.             <a href="{{path('articles_category',{
  52.                 category3_slug:item.category.category2.category3.slug,
  53.                 category2_slug:item.category.category2.slug,
  54.                 category:article.category.slug}) }}">{{ item.category.title }}</a>
  55.         </div>
  56.         <!-- End .product-cat -->
  57.         <h3 class="product-title">
  58.             <a href="{{ path('articles_show', { category: item.category.slug, slug: item.slug, id: item.id}) }}">
  59.                 {{ item.title }}
  60.             </a>
  61.         </h3>
  62.         <!-- End .product-title -->
  63.         <div class="product-price">
  64.            {% if item.reduction > 0 %}
  65.            {{  item.newPrice|number_format(0,'.', ' ')}} {{site.current_name }}
  66.             <span class="old-price ml-1">
  67.                 {{ item.price|number_format(0,'.',' ')}} {{site.current_name }}
  68.             </span>
  69.             {% else %}                
  70.             {{ item.newPrice|number_format(0,'.',' ')}} {{site.current_name }}
  71.         {% endif %}
  72.         </div>
  73.         <!-- End .product-price -->
  74.         <div class="ratings-container">
  75.             <div class="ratings">
  76.                 <div class="ratings-val" style="width: {{ rating(item) }}%;"></div>
  77.                 <!-- End .ratings-val -->
  78.             </div>
  79.             <!-- End .ratings -->
  80.             <span class="ratings-text">
  81.                 ({{ item.comments|length}} <i class="fas fa-comment"></i>)
  82.             </span>
  83.         </div>
  84.         <!-- End .rating-container -->
  85.     </div>
  86.     <!-- End .product-body -->
  87. </div>
  88. <!-- End .product -->