templates/includes/product-list-item.html.twig line 1

Open in your IDE?
  1. {% set detailLink = app_product_detaillink(item) %}
  2. <article class="product product--row">
  3.     <div class="product__img">
  4.         <favorite-button
  5.             product-id="{{ item.id }}"
  6.             :is-current-favorite="{{ item.id in favoriteIds ? 'true' : 'false' }}"
  7.         ></favorite-button>
  8.     </div>
  9.     <div class="product__info">
  10.         <div class="product__text">
  11.             <p class="title"><a href="{{ detailLink }}">{{ item.name }}</a></p>
  12.         {% if item.onOrder %}
  13.             <span class="d-inline-flex align-items-center mb-1">
  14.                 <span class="badge bg-danger">{{ 'Op bestelling!'|trans }}</span>
  15.                 {% set orderMessage = product_order_message(item) %}
  16.                 {% if orderMessage %}
  17.                     <ranking-info-button :message="{{ orderMessage|json_encode }}"></ranking-info-button>
  18.                 {% endif %}
  19.             </span>
  20.         {% endif %}
  21.             <p>{{ 'Code'|trans }}: {{ item.code }} — {{ 'Merk'|trans }}: {{ item.brand }}</p>
  22.             {% if item.categoryTypes %}
  23.                 <p>{{ 'Categorietype'|trans }}: {{ item.categoryTypes|map(t => t.name)|join(', ') }}</p>
  24.             {% endif %}
  25.         </div>
  26.     </div>
  27.         <div class="product__price">
  28.             {% if not item.OSPrice.getAmount.isZero %}
  29.                 <div class="price {% if item.promoDate1 and item.promoDate2 and date(item.promoDate1) < date() and date(item.promoDate2) > date() %}
  30.                     price--promo
  31.                 {% endif %}">{{ item.OSPrice }}<small class="price-unit">/{{ item.unit }}</small></div>
  32.                 {% if( item.discount ) %}
  33.                     {% if( item.OSPrice != item.OSDefaultPrice )  %}
  34.                         <p class="old-price">{{ item.OSDefaultPrice }}</p>
  35.                     {% endif %}
  36.                     <div class="promo">-{{ item.discount }}%</div>
  37.                 {% endif %}
  38.             {% endif %}
  39.             {% if
  40.                 item.promoDate1 and item.promoDate2 and
  41.                 date(item.promoDate1) < date() and date(item.promoDate2) > date()
  42.             %}
  43.                 {# Show promo price even when prices should not show #}
  44.                 {% if item.OSPrice.getAmount.isZero %}
  45.                     {% if item.promoPrice %}
  46.                         <div class="price price--promo">{{ item.promoPrice | currency }}<small class="price-unit">/{{ item.unit }}</small></div>
  47.                     {% endif %}
  48.                     {% if( item.promoPercentage ) %}
  49.                         <div class="promo">-{{ item.promoPercentage }}%</div>
  50.                     {% endif %}
  51.                 {% endif %}
  52.                 <p class="date">({{ 'Promotie vanaf'|trans}} {{ item.promoDate1|date('d/m/Y') }} {{'tot'|trans}} {{ item.promoDate2|date('d/m/Y') }})</p>
  53.             {% endif %}
  54.         </div>
  55.     <div class="product__controls">
  56.        {% if cartList is defined and cartList %}
  57.            <change-cartitem-quantity
  58.                product-id="{{ item.id }}"
  59.                :current-quantity="{{ cartItem.count }}"
  60.                unit="{{ item.unit }}"
  61.                minimum-unit="{{ item.unitMinimum }}"
  62.            ></change-cartitem-quantity>
  63.            <remove-cart-item-button
  64.                product-id="{{ item.id }}"
  65.            ></remove-cart-item-button>
  66.         {% else %}
  67.             <add-to-cart
  68.                 product-id="{{ item.id }}"
  69.                 unit="{{ item.unit }}"
  70.                 minimum-unit="{{ item.unitMinimum }}"
  71.                 amount-in-cart="{{ cartItems[item.id] ?? 0 }}"
  72.             ></add-to-cart>
  73.         {% endif %}
  74.     </div>
  75. </article>