vendor/shopware/storefront/Resources/views/storefront/component/buy-widget/configurator.html.twig line 1

Open in your IDE?
  1. {% block buy_widget_configurator %}
  2.     <div class="product-detail-configurator">
  3.         {% if elementId is defined and elementId is not null and pageType != 'product_detail' %}
  4.             {% set config = {
  5.                 url: url('frontend.cms.buybox.switch', { productId: product.parentId }),
  6.                 elementId: elementId,
  7.                 pageType: pageType
  8.             } %}
  9.         {% else %}
  10.             {% set config = {
  11.                 url: url('frontend.detail.switch', { productId: product.parentId }),
  12.                 pageType: pageType
  13.             } %}
  14.         {% endif %}
  15.         {% block buy_widget_configurator_form %}
  16.             <form data-variant-switch="true" data-variant-switch-options="{{ config|json_encode }}">
  17.                 {# @deprecated tag:v6.5.0 - Block buy_widget_configurator_csrf will be removed. #}
  18.                 {% block buy_widget_configurator_csrf %}
  19.                     {% if elementId is defined and elementId is not null %}
  20.                         {{ sw_csrf('frontend.cms.buybox.switch') }}
  21.                     {% else %}
  22.                         {{ sw_csrf('frontend.detail.switch') }}
  23.                     {% endif %}
  24.                 {% endblock %}
  25.                 {% block buy_widget_configurator_groups %}
  26.                     {% for group in configuratorSettings %}
  27.                         {% block buy_widget_configurator_group %}
  28.                             <div class="product-detail-configurator-group">
  29.                                 {% if group.displayType == 'select' %}
  30.                                     {% sw_include '@Storefront/storefront/page/product-detail/configurator/select.html.twig' %}
  31.                                 {% else %}
  32.                                     {% block buy_widget_configurator_group_title %}
  33.                                         <div class="product-detail-configurator-group-title">
  34.                                             {% block buy_widget_configurator_group_title_text %}
  35.                                                 {{ group.translated.name }}
  36.                                             {% endblock %}
  37.                                         </div>
  38.                                     {% endblock %}
  39.                                     {% block buy_widget_configurator_options %}
  40.                                         <div class="product-detail-configurator-options">
  41.                                             {% for option in group.options %}
  42.                                                 {% if elementId is defined and elementId is not null %}
  43.                                                     {% set optionIdentifier = [group.id, option.id, elementId]|join('-') %}
  44.                                                 {% else %}
  45.                                                     {% set optionIdentifier = [group.id, option.id]|join('-') %}
  46.                                                 {% endif %}
  47.                                                 {% set isActive = false %}
  48.                                                 {% set isCombinableCls = 'is-combinable' %}
  49.                                                 {% if option.id in product.optionIds %}
  50.                                                     {% set isActive = true %}
  51.                                                 {% endif %}
  52.                                                 {% if not option.combinable %}
  53.                                                     {% set isCombinableCls = false %}
  54.                                                 {% endif %}
  55.                                                 {% if option.configuratorSetting.media %}
  56.                                                     {% set displayType = 'media' %}
  57.                                                     {% set media = option.configuratorSetting.media %}
  58.                                                 {% else %}
  59.                                                     {% set displayType = group.displayType %}
  60.                                                     {% if option.media %}
  61.                                                         {% set media = option.media %}
  62.                                                     {% else %}
  63.                                                         {% set media = false %}
  64.                                                     {% endif %}
  65.                                                 {% endif %}
  66.                                                 {% block buy_widget_configurator_option %}
  67.                                                     <div class="product-detail-configurator-option">
  68.                                                         {% block buy_widget_configurator_option_radio %}
  69.                                                             <input type="radio"
  70.                                                                    name="{{ group.id }}"
  71.                                                                    value="{{ option.id }}"
  72.                                                                    class="product-detail-configurator-option-input{% if isCombinableCls %} {{ isCombinableCls }}{% endif %}"
  73.                                                                    title="{{ optionIdentifier }}"
  74.                                                                    id="{{ optionIdentifier }}"
  75.                                                                    {% if isActive %}checked="checked"{% endif %}>
  76.                                                             {% block buy_widget_configurator_option_radio_label %}
  77.                                                                 <label class="product-detail-configurator-option-label{% if isCombinableCls %} {{ isCombinableCls }}{% endif %} is-display-{{ displayType }}"
  78.                                                                     {% if displayType == 'color' and option.colorHexCode %}
  79.                                                                         style="background-color: {{ option.colorHexCode }}"
  80.                                                                     {% endif %}
  81.                                                                        title="{{ option.translated.name }}"
  82.                                                                        for="{{ optionIdentifier }}">
  83.                                                                     {% if displayType == 'media' and media %}
  84.                                                                         {% block buy_widget_configurator_option_radio_label_media %}
  85.                                                                             {% sw_thumbnails 'configurator-option-img-thumbnails' with {
  86.                                                                                 media: media,
  87.                                                                                 sizes: {
  88.                                                                                     'default': '52px'
  89.                                                                                 },
  90.                                                                                 attributes: {
  91.                                                                                     'class': 'product-detail-configurator-option-image',
  92.                                                                                     'alt': option.translated.name,
  93.                                                                                     'title': option.translated.name
  94.                                                                                 }
  95.                                                                             } %}
  96.                                                                         {% endblock %}
  97.                                                                     {% elseif displayType == 'text' or
  98.                                                                         (displayType == 'media' and not media) or
  99.                                                                         (displayType == 'color' and not option.colorHexCode) %}
  100.                                                                         {% block buy_widget_configurator_option_radio_label_text %}
  101.                                                                             {{ option.translated.name }}
  102.                                                                         {% endblock %}
  103.                                                                     {% endif %}
  104.                                                                 </label>
  105.                                                             {% endblock %}
  106.                                                         {% endblock %}
  107.                                                     </div>
  108.                                                 {% endblock %}
  109.                                             {% endfor %}
  110.                                         </div>
  111.                                     {% endblock %}
  112.                                 {% endif %}
  113.                             </div>
  114.                         {% endblock %}
  115.                     {% endfor %}
  116.                 {% endblock %}
  117.             </form>
  118.         {% endblock %}
  119.     </div>
  120. {% endblock %}