themes/BootstrapChildTheme/SyliusShopBundle/views/Product/Show/_tier_price_promo.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. {% set variantsBreakpoints = product.variantsBreakpoints(sylius.channel, sylius.customer) %}
  3. {% set brand = product.brand %}
  4. {% if variantsBreakpoints|length %}
  5. <div class="d-none d-md-block">
  6.     <h3>{{ 'app.product.detail.choose_variant'|trans }}</h3>
  7.     <div id="tier_prices_tables" class="table-prices rounded-top table-responsive"
  8.          data-min-qty="{{ product.calculateMinQty }}"
  9.          data-only-breakpoints="{{ product.onlyBreakpoints ? 1 : 0 }}"
  10.          {% if brand %}data-setup-charge="{{ brand.setupDefault }}" data-plate-charge="{{ brand.plateDefault }}" data-plate-per-color="{{ brand.platePerColor }}" {% endif %}>
  11.         <table class="table">
  12.             <tbody>
  13.                 <tr>
  14.                     <th>Type</th>
  15.                     {% for qty in variantsBreakpoints["all"] %}
  16.                         <th>{{ qty }}<span> pcs</span></th>
  17.                     {% endfor %}
  18.                 </tr>
  19.             {% set first = true %}
  20.             {% for product_variant in product.enabledVariants %}
  21.                 {# Vypise do tabulky len varianty, kde je iba jeden options; Predpoklad je, ze option typu "type" to bude #}
  22.                 {% if product_variant.optionValues|length == 1 %}
  23.                     {% set tier_prices = product_variant.getTierPricesForChannel(sylius.channel, sylius.customer) %}
  24.                     <tr id="variant-{{ product_variant.id }}" class="{% if loop.index is odd %}odd{% else %}even{% endif %}{% if product_variant.optionValues[0].option.code != 'type'%} no-type{% endif %}">
  25.                         <td class="first">
  26.                             <b>{{ product_variant.optionValues.first.value }}</b>
  27.                         </td>
  28.                         {% for qty in variantsBreakpoints["all"] %}
  29.                             {% set tierPrice = product_variant.tierPriceByQty(qty, tier_prices) %}
  30.                             {% include '@SyliusShop/Product/Show/_priceTier.html.twig' with { 'variant': product_variant, 'tierPrice': tierPrice, 'first': first, 'isType': product_variant.optionValues[0].option.code == 'type' } %}
  31.                             {% set first = false %}
  32.                         {% endfor %}
  33.                     </tr>
  34.                 {% endif %}
  35.             {% endfor %}
  36.             </tbody>
  37.         </table>
  38.         <script type="text/javascript">
  39.             window.variantsBreakpoints = JSON.parse('{{ variantsBreakpoints | json_encode | e('js') }}');
  40.             window.variantsBreakpointsPrices = JSON.parse('{{ product.variantsBreakpointsPricesForJs(sylius.channel, sylius.customer) | json_encode | e('js') }}');
  41.         </script>
  42.     </div>
  43.     {% if product.minQuantity %}
  44.         <div class="product-min-quantity">{{ 'app.product_box.min_qty'|trans({ '%qty%': product.minQuantity }) }}</div>
  45.     {% endif %}
  46. </div>
  47. {% endif %}