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