vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/views/Product/Show/_variants.html.twig line 1

  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. <table class="ui single line small table" id="sylius-product-variants" {{ sylius_test_html_attribute('product-variants') }}>
  3.     <thead>
  4.     <tr>
  5.         <th>{{ 'sylius.ui.variant'|trans }}</th>
  6.         <th>{{ 'sylius.ui.price'|trans }}</th>
  7.         <th></th>
  8.     </tr>
  9.     </thead>
  10.     <tbody>
  11.     {% for key, variant in product.enabledVariants %}
  12.         {% set channelPricing = variant.getChannelPricingForChannel(sylius.channel) %}
  13.         <tr {{ sylius_test_html_attribute('product-variants-row') }}>
  14.             <td>
  15.                 {{ variant.name|default(variant.descriptor) }}
  16.                 {% if product.hasOptions() %}
  17.                     <div class="ui horizontal divided list">
  18.                         {% for optionValue in variant.optionValues %}
  19.                             <div class="item">
  20.                                 {{ optionValue.value }}
  21.                             </div>
  22.                         {% endfor %}
  23.                     </div>
  24.                 {% endif %}
  25.             </td>
  26.             {% set appliedPromotions = channelPricing.appliedPromotions|map(promotion => ({'label': promotion.label, 'description': promotion.description})) %}
  27.             <td class="sylius-product-variant-price" data-applied-promotions="{{ appliedPromotions|json_encode }}"  {% if variant|sylius_has_discount({'channel': sylius.channel}) %}data-original-price="{{ money.calculateOriginalPrice(variant) }}"{% endif %}>
  28.                 {{ money.calculatePrice(variant) }}
  29.             </td>
  30.             <td class="right aligned">
  31.                 {{ form_widget(form.cartItem.variant[key], {'label': false}) }}
  32.             </td>
  33.         </tr>
  34.     {% endfor %}
  35.     </tbody>
  36. </table>