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