custom/static-plugins/NdTheme/src/Resources/views/storefront/component/buy-widget/configurator.html.twig line 1

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