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