custom/static-plugins/EfbStorefront/Resources/views/storefront/page/product-detail/tabs/variants.html.twig line 1

Open in your IDE?
  1. <h3 class="product-details-tab subtitle">
  2.     {{ 'detail.tabsVariants'|trans|sw_sanitize }}
  3. </h3>
  4. <div class="product-details-variants">
  5.     {% set variants = page.product.extensions.variants %}
  6.     {% set tableAttributes = page.product.extensions.tableAttributes %}
  7.     <table class="table table-striped product-details-variants-table">
  8.         <thead>
  9.         <th>
  10.             {{ "detail.variantsTableOrderNumberLabel"|trans|sw_sanitize }}
  11.         </th>
  12.         <th>
  13.             {{ "detail.variantsTableNameLabel"|trans|sw_sanitize }}
  14.         </th>
  15.         {% for property in tableAttributes.properties %}
  16.             <th>
  17.                 {{ property.name }}
  18.             </th>
  19.         {% endfor %}
  20.         {% if context.customer %}
  21.             <th>
  22.                 {{ "detail.variantsTableStockLabel"|trans|sw_sanitize }}
  23.             </th>
  24.             <th>
  25.                 {{ "detail.variantsTablePriceLabel"|trans|sw_sanitize }}
  26.             </th>
  27.         {% endif %}
  28.         <th></th>
  29.         </thead>
  30.         <tbody>
  31.         {% for variant in variants %}
  32.             {% set product = variant %}
  33.             {% set id = product.id %}
  34.             <tr data-id="{{ variant.id }}">
  35.                 <td>
  36.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  37.                        title=" {{ variant.productNumber }}">
  38.                         {{ variant.productNumber }}
  39.                     </a>
  40.                 </td>
  41.                 <td>{{ variant.translated.name }}</td>
  42.                 {% for property in tableAttributes.properties %}
  43.                     {% set propertyValue = tableAttributes.productPropertyValueCollection.getPropertyValueOfProduct(variant.id, property.identifier) %}
  44.                     <td>{{ propertyValue ? propertyValue.value : '-' }}</td>
  45.                 {% endfor %}
  46.                 {% if context.customer %}
  47.                     <td>
  48.                         {% set stockInfo = decodeStockInfo(variant, context) %}
  49.                         {% if stockInfo and stockInfo.stock is defined %}
  50.                             <div class="variants-stock-info--item">
  51.                                 <span>{{ "detail.available"|trans|sw_sanitize }}</span>
  52.                                 <span>
  53.                                 {% if stockInfo.stock > 1000 %}
  54.                                     1000+
  55.                                 {% else %}
  56.                                     {{ stockInfo.stock }}
  57.                                 {% endif %}
  58.                             </span>
  59.                             </div>
  60.                             {% if stockInfo.restock is defined and stockInfo.restock is iterable and stockInfo.restock|length > 0 %}
  61.                                 {% for cw, amount in stockInfo.restock %}
  62.                                     <div class="variants-stock-info--item">
  63.                                         <span>{{ "detail.cw"|trans|sw_sanitize }}{{ cw }}</span>
  64.                                         <span>{{ amount }}</span>
  65.                                     </div>
  66.                                 {% endfor %}
  67.                             {% endif %}
  68.                         {% else %}
  69.                             {% if variant.availableStock > 1000 %}
  70.                                 <div class="variants-stock-info--item">
  71.                                     <span>{{ "detail.available"|trans|sw_sanitize }}</span>
  72.                                     <span>1000+</span>
  73.                                 </div>
  74.                             {% else %}
  75.                                 <div class="variants-stock-info--item">
  76.                                     <span>{{ "detail.available"|trans|sw_sanitize }}</span>
  77.                                     <span>{{ variant.availableStock }}</span>
  78.                                 </div>
  79.                             {% endif %}
  80.                             {% if variant.availableStock <= 0 and variant.restockTime %}
  81.                                 {{ "detail.variantsTableStockRestockInformation"|trans({'%restockTime%': product.restockTime})|sw_sanitize }}
  82.                             {% endif %}
  83.                         {% endif %}
  84.                     </td>
  85.                     <td>
  86.                         <strong>{{ variant.calculatedPrice.totalPrice|currency }}</strong>
  87.                          {#
  88.                          <div class="product-detail-price-unit">
  89.                             <span class="price-unit-label">
  90.                                 {{ "detail.priceUnitName"|trans|sw_sanitize }}<br>
  91.                             </span>
  92.                             <span class="price-unit-content">
  93.                                 {{ variant.purchaseUnit }} {{ "detail.perPackUnit"|trans|sw_sanitize }} {{ variant.translated.packUnit }}
  94.                             </span>
  95.                             {% if variant.calculatedPrice.referencePrice is not null %}
  96.                                 <span class="price-unit-reference-content">
  97.                                     ({{ variant.calculatedPrice.referencePrice|currency }} / {% if variant.calculatedPrice.referencePrice.referenceUnit > 1 %}{{ variant.calculatedPrice.referencePrice.referenceUnit }} {% endif %}{{ variant.calculatedPrice.referencePrice.unitName }})
  98.                                 </span>
  99.                             {% endif %}
  100.                         </div>
  101.                          #}
  102.                     </td>
  103.                 {% endif %}
  104.                 <td class="product-details-variants-table-action-column">
  105.                     {% sw_include '@Storefront/storefront/component/product/card/variant-action.html.twig' %}
  106.                 </td>
  107.             </tr>
  108.         {% endfor %}
  109.         </tbody>
  110.     </table>
  111. </div>