templates/main/shop/_articles_list.html.twig line 1

Open in your IDE?
  1. {% import "macros/article.html.twig" as articleMacro %}
  2. <div class="products mb-3">
  3.     {% for item in articles %}
  4.     <div class="product product-list">
  5.         <div class="row">
  6.             <div class="col-6 col-lg-3">
  7.                 <figure class="product-media">
  8.                 {% if item.quantity <= 0 %} <span class="product-label label-out bg-danger">
  9.                         {{'Out of Stock'|trans}}</span>
  10.                         {% endif %}
  11.                     {% import "macros/etats.html.twig" as etats %}
  12.                     {{ etats.articleLabel(item.label) }}
  13.                     
  14.                     {% if item.reduction > 0 %}
  15.                     <span class="product-label mt-3 label-out bg-danger">-{{ item.reduction}}%</span>
  16.                     {% endif %}
  17.                     <a {{ articleMacro.href_show(item)}}>
  18.                         {% set article_img = (item.images[0] is defined)? item.images[0]:'' %}
  19.                         {% if article_img is not empty %}
  20.                         <img src="{{ asset('img/article/' ~ article_img.name) }}" alt="..."
  21.                             class="product-image">
  22.                         {% else %}
  23.                         <img src="{{  asset('img/vide.png') }}" alt="..." class="product-image">
  24.                         {% endif %}
  25.                     </a>
  26.                 </figure><!-- End .product-media -->
  27.             </div><!-- End .col-sm-6 col-lg-3 -->
  28.             <div class="col-6 col-lg-3 order-lg-last">
  29.                 <div class="product-list-action">
  30.                     <div class="product-price">
  31.                         {% if item.reduction > 0 %}
  32.                         {{ item.newPrice|price_format ~ ' ' ~ site.current_name}}
  33.                         <span class="old-price ml-1">
  34.                             {{ item.price|price_format ~ ' ' ~ site.current_name}}
  35.                         </span>
  36.                         {% else %}
  37.                         {{ item.newPrice|price_format ~ ' ' ~ site.current_name}}
  38.                         {% endif %}
  39.                     </div><!-- End .product-price -->
  40.                     <div class="ratings-container">
  41.                         <div class="ratings">
  42.                             <div class="ratings-val" {{ ratingStyle(item) }}></div>
  43.                             <!-- End .ratings-val -->
  44.                         </div><!-- End .ratings -->
  45.                         <span class="ratings-text">
  46.                             ({{ item.comments|length}} <i class="fas fa-comment"></i>)
  47.                         </span>
  48.                     </div><!-- End .rating-container -->
  49.                     {% if item.quantity > 0 %}
  50.                     
  51.                 
  52.                     <a class="btn-product btn-cart js-btn-add-qty" href="#" data-path="{{path('cart_add_qty_ajax',{id:item.id})}}">
  53.                     <span>{{'add to cart'|trans}}</span>
  54.                     </a>
  55.                     {% endif %}
  56.                 </div><!-- End .product-list-action -->
  57.             </div><!-- End .col-sm-6 col-lg-3 -->
  58.             <div class="col-lg-6 article-{{item.id }}">
  59.                 <div class="product-body product-action-inner">
  60.                     {% if app.user %}
  61.                     {% if not isToFavoris(app.user, item) %}
  62.                     <a href="{{ path('favoris_add',{id:item.id}) }}" data-id="{{ item.id }}"
  63.                         class="btn-product-icon btn-wishlist js-favoris js-add-favoris" title="{{'Add to wishlist'|trans}}">
  64.                         <span>{{'add to wishlist'|trans}}</span>
  65.                     </a>
  66.                     {% else %}
  67.                     <a href="{{ path('favoris_remove',{id:item.id}) }}" data-id="{{ item.id }}"
  68.                         class="btn-product-icon btn-wishlist js-favoris  bg-danger js-remove-favoris">
  69.                         <span class="bg-danger text-white">{{'remove to wishlist'|trans}}</span>
  70.                     </a>
  71.                     {% endif %}
  72.                     {% else %}
  73.                     <a href="#" class="btn-product-icon btn-wishlist js-favoris-login">
  74.                         <span>{{'add to wishlist'|trans}}</span>
  75.                     </a>
  76.                     {% endif %}
  77.                     <div class="product-cat">
  78.                         <a {{ articleMacro.href_category(item)}} >
  79.                             {{ item.category.category2.title }} | {{ item.category.title }}
  80.                         </a>
  81.                     </div><!-- End .product-cat -->
  82.                     <h3 class="product-title"><a {{articleMacro.href_show(item)}}>
  83.                             {{item.title}}
  84.                         </a></h3><!-- End .product-title -->
  85.                     <div class="product-content">
  86.                         <p>
  87.                             {{item.detail}}
  88.                         </p>
  89.                     </div><!-- End .product-content -->
  90.                     <div class="product-nav product-nav-thumbs">
  91.                         {% for item in item.images|slice(1,4) %}
  92.                         <a type="button" href="#" {{ loop.index==0 ? 'class="active"' :'' }}>
  93.                             <img src="{{ asset('img/article/' ~ item.name ) }}" alt="">
  94.                         </a>
  95.                         {% endfor %}
  96.                     </div>
  97.                 </div><!-- End .product-body -->
  98.             </div><!-- End .col-lg-6 -->
  99.         </div><!-- End .row -->
  100.     </div><!-- End .product -->
  101.     {% else %}
  102.     {% include base ~ "/shop/_articles_empty.html.twig" %}
  103.     {% endfor %}
  104. </div><!-- End .products -->
  105. {% include base ~ "/shop/_pagination.html.twig" %}