vendor/shopware/storefront/Resources/views/storefront/page/product-detail/configurator.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_configurator %}
  2.     <div class="product-detail-configurator">
  3.         {% set config = {
  4.             url: url('frontend.detail.switch', { productId: page.product.parentId })
  5.         } %}
  6.         {% block page_product_detail_configurator_form %}
  7.             <form data-variant-switch="true" data-variant-switch-options="{{ config|json_encode }}">
  8.                 {% block page_product_detail_configurator_csrf %}
  9.                     {{ sw_csrf('frontend.detail.switch') }}
  10.                 {% endblock %}
  11.                 {% block page_product_detail_configurator_groups %}
  12.                     {% for group in page.configuratorSettings %}
  13.                         {% block page_product_detail_configurator_group %}
  14.                             <div class="product-detail-configurator-group">
  15.                                 {% if group.displayType == 'select' %}
  16.                                     {% sw_include '@Storefront/storefront/page/product-detail/configurator/select.html.twig' %}
  17.                                 {% else %}
  18.                                     {% block page_product_detail_configurator_group_title %}
  19.                                         <div class="product-detail-configurator-group-title">
  20.                                             {% block page_product_detail_configurator_group_title_text %}
  21.                                                 {{ group.translated.name }}
  22.                                             {% endblock %}
  23.                                         </div>
  24.                                     {% endblock %}
  25.                                     {% block page_product_detail_configurator_options %}
  26.                                         <div class="product-detail-configurator-options">
  27.                                             {% for option in group.options %}
  28.                                                 {% set optionIdentifier = [group.id, option.id]|join('-') %}
  29.                                                 {% set isActive = false %}
  30.                                                 {% set isCombinableCls = 'is-combinable' %}
  31.                                                 {% if option.id in page.product.optionIds %}
  32.                                                     {% set isActive = true %}
  33.                                                 {% endif %}
  34.                                                 {% if not option.combinable %}
  35.                                                     {% set isCombinableCls = false %}
  36.                                                 {% endif %}
  37.                                                 {% if option.configuratorSetting.media %}
  38.                                                     {% set displayType = 'media' %}
  39.                                                     {% set media = option.configuratorSetting.media %}
  40.                                                 {% else %}
  41.                                                     {% set displayType = group.displayType %}
  42.                                                     {% if option.media %}
  43.                                                         {% set media = option.media %}
  44.                                                     {% else %}
  45.                                                         {% set media = false %}
  46.                                                     {% endif %}
  47.                                                 {% endif %}
  48.                                                 {% block page_product_detail_configurator_option %}
  49.                                                     <div class="product-detail-configurator-option">
  50.                                                         {% block page_product_detail_configurator_option_radio %}
  51.                                                             <input type="radio"
  52.                                                                    name="{{ group.id }}"
  53.                                                                    value="{{ option.id }}"
  54.                                                                    class="product-detail-configurator-option-input{% if isCombinableCls %} {{ isCombinableCls }}{% endif %}"
  55.                                                                    title="{{ optionIdentifier }}"
  56.                                                                    id="{{ optionIdentifier }}"
  57.                                                                    {% if isActive %}checked="checked"{% endif %}>
  58.                                                             {% block page_product_detail_configurator_option_radio_label %}
  59.                                                                 <label class="product-detail-configurator-option-label{% if isCombinableCls %} {{ isCombinableCls }}{% endif %} is-display-{{ displayType }}"
  60.                                                                        {% if displayType == 'color' and option.colorHexCode %}
  61.                                                                        style="background-color: {{ option.colorHexCode }}"
  62.                                                                        {% endif %}
  63.                                                                        title="{{ option.translated.name }}"
  64.                                                                        for="{{ optionIdentifier }}">
  65.                                                                     {% if displayType == 'media' and media %}
  66.                                                                         {% block page_product_detail_configurator_option_radio_label_media %}
  67.                                                                             {% sw_thumbnails 'configurator-option-img-thumbnails' with {
  68.                                                                                 media: media,
  69.                                                                                 sizes: {
  70.                                                                                     'default': '52px'
  71.                                                                                 },
  72.                                                                                 attributes: {
  73.                                                                                     'class': 'product-detail-configurator-option-image',
  74.                                                                                     'alt': option.translated.name,
  75.                                                                                     'title': option.translated.name
  76.                                                                                 }
  77.                                                                             } %}
  78.                                                                         {% endblock %}
  79.                                                                     {% elseif displayType == 'text' or
  80.                                                                               (displayType == 'media' and not media) or
  81.                                                                               (displayType == 'color' and not option.colorHexCode) %}
  82.                                                                         {% block page_product_detail_configurator_option_radio_label_text %}
  83.                                                                             {{ option.translated.name }}
  84.                                                                         {% endblock %}
  85.                                                                     {% endif %}
  86.                                                                 </label>
  87.                                                             {% endblock %}
  88.                                                         {% endblock %}
  89.                                                     </div>
  90.                                                 {% endblock %}
  91.                                             {% endfor %}
  92.                                         </div>
  93.                                     {% endblock %}
  94.                                 {% endif %}
  95.                             </div>
  96.                         {% endblock %}
  97.                     {% endfor %}
  98.                 {% endblock %}
  99.             </form>
  100.         {% endblock %}
  101.     </div>
  102. {% endblock %}