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