custom/plugins/SchilderSysteme/src/Resources/views/storefront/component/product/table.html.twig line 58

Open in your IDE?
  1. {% block component_product_table_container %}
  2.     {% set variants = page.product.customFields.variants %}
  3.     {% set ruleId = page.product.cheapestPrice.ruleId %}
  4.     {% set staplelength = product.calculatedPrices.elements|length - 1 %}
  5.     {% if variants|length > 0 %}
  6.         {% if page.product.calculatedPrices|length > 1 %}
  7.             {% set bestprice = false %}
  8.             {% for variant in variants|filter((variant) => variant.availableStock == true) %}
  9.                 {% if variant.customFields.custom_units_piece_per_pu != 1 %}
  10.                     {% set bestprice = true %}
  11.                 {% endif %}
  12.             {% endfor %}
  13.             {% if bestprice == true %}
  14.                 <div class="product-detail-table-container">
  15.                     <table class="product-detail-table {% if product.calculatedPrices|length > 1 %}has-badge{% endif %}">
  16.                         <tr class="table--header">
  17.                             <th align="center" class="price-list-item">{{ "detail.TableArtNr"|trans|sw_sanitize }}</th>
  18.                             <th align="center" class="price-list-item">Variante</th>
  19.                             <th align="center" class="price-list-item">VE</th>
  20.                             <th align="center"
  21.                                 class="price-list-item">{{ "detail.tableAvailable"|trans|sw_sanitize }}</th>
  22.                             <th align="center"
  23.                                 class="price-list-item">{{ "detail.tableQuantity"|trans|sw_sanitize }}</th>
  24.                             {% for price in product.calculatedPrices.elements %}
  25.                                 {% if loop.last == false and loop.index<=4 %}
  26.                                     <th align="center" class="price-list-item">
  27.                                         {% if product.calculatedPrices|length > 1 %}
  28.                                             <div class="discount-badge">
  29.                                                 {% if loop.index == 1 %}-5%{% endif %}
  30.                                                 {% if loop.index == 2 %}-8%{% endif %}
  31.                                                 {% if loop.index == 3 %}-10%{% endif %}
  32.                                                 {% if loop.index == 4 %}-12%{% endif %}
  33.                                             </div>
  34.                                         {% endif %}
  35.                                         {{ (price.quantity + 1) }} VE / Stück
  36.                                     </th>
  37.                                 {% endif %}
  38.                             {% endfor %}
  39.                             <th align="center"
  40.                                 class="price-list-item">{{ "detail.tableDesiredQuantityVE"|trans|sw_sanitize }}</th>
  41.                         </tr>
  42.                         <tr>
  43.                             {% for variant in variants|filter((variant) => variant.availableStock == true) %}
  44.                             {% if variant.customFields.custom_units_piece_per_pu !='1' %}
  45.                             {% set pricesVariant = variant.prices.elements|sort((a, b) => a.quantityStart <=> b.quantityStart) %}
  46.                         <tr>
  47.                             <td>{{ variant.productNumber }}</td>
  48.                             <td>
  49.                                 {% for variation in variant.variation %}
  50.                                     {% if loop.first %}{{ variation.option }}{% else %}, {{ variation.option }}{% endif %}
  51.                                 {% endfor %}
  52.                             </td>
  53.                             <td>{{ variant.customFields.custom_units_piece_per_pu }}</td>
  54.                             <td class="d-flex">{% if variant.availableStock %} <span
  55.                                         class="delivery-status-indicator bg-success mx-auto"></span>{% endif %}</td>
  56.                             <td>{{ (variant.price.elements|first.net/variant.customFields.custom_units_piece_per_pu)|round(2, 'floor')|currency }}</td>
  57.                             {% set arrayRuleId = pricesVariant|filter((el) => el.ruleId == ruleId) %}
  58.                             {% for i in 1..staplelength %}
  59.                                 {% set mainloop = loop.index + 1 %}
  60.                                 {% if mainloop <= 5 %}
  61.                                     <td align="center">
  62.                                         <strong>
  63.                                             {% for item in arrayRuleId %}
  64.                                                 {% if loop.index == mainloop %}
  65.                                                     {{ (item.price.elements|first.net/variant.customFields.custom_units_piece_per_pu)|round(2, 'floor')|currency }}
  66.                                                 {% endif %}
  67.                                             {% endfor %}
  68.                                         </strong>
  69.                                     </td>
  70.                                 {% endif %}
  71.                             {% endfor %}
  72.                             <td>
  73.                                 {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form-table.html.twig' with {
  74.                                     productTable: variant
  75.                                 } %}
  76.                             </td>
  77.                         </tr>
  78.                         {% endif %}
  79.                         {% endfor %}
  80.                     </table>
  81.                 </div>
  82.             {% endif %}
  83.         {% endif %}
  84.     {% endif %}
  85. {% endblock %}