custom/plugins/AmMacTrade/src/Resources/views/storefront/page/product-detail/configurator.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_configurator %}
  2.     <div class="product-detail-configurator">
  3.         {% set config = {
  4.             url: url('frontend.detail.switch', { productId: page.product.parentId })
  5.         } %}
  6.         {% block page_product_detail_configurator_form %}
  7.             <form data-variant-switch="true" data-variant-switch-options="{{ config|json_encode }}">
  8.                 {% block page_product_detail_configurator_csrf %}
  9.                     {{ sw_csrf('frontend.detail.switch') }}
  10.                 {% endblock %}
  11.                 {% block page_product_detail_configurator_groups %}
  12.                     {% for group in page.configuratorSettings %}
  13.                         {% block page_product_detail_configurator_group %}
  14.                             <div class="product-detail-configurator-group">
  15.                                 {% block page_product_detail_configurator_group_title %}
  16.                                     <div class="product-detail-configurator-group-title">
  17.                                         {% block page_product_detail_configurator_group_title_text %}
  18.                                             {{ group.translated.name }}
  19.                                             {% if(group.translated.description) %}
  20.                                                 <span class="info" title="Klicken und mehr erfahren"><img src="{{ asset('assets/images/ico_info.svg', "@AmMacTrade") }}"></span>
  21.                                             {% endif %}
  22.                                             <div class="info-text">
  23.                                                 {{ group.translated.description }}
  24.                                             </div>
  25.                                         {% endblock %}
  26.                                     </div>
  27.                                 {% endblock %}
  28.                                 {% block page_product_detail_configurator_options %}
  29.                                     <div class="product-detail-configurator-options">
  30.                                         {% for option in group.options %}
  31.                                             {% set optionIdentifier = [group.id, option.id]|join('-') %}
  32.                                             {% set isActive = false %}
  33.                                             {% set isCombinableCls = 'is-combinable' %}
  34.                                             {% if option.id in page.product.optionIds %}
  35.                                                 {% set isActive = true %}
  36.                                             {% endif %}
  37.                                             {% if not option.combinable %}
  38.                                                 {% set isCombinableCls = false %}
  39.                                             {% endif %}
  40.                                             {% if option.configuratorSetting.media %}
  41.                                                 {% set displayType = 'media' %}
  42.                                                 {% set media = option.configuratorSetting.media %}
  43.                                             {% else %}
  44.                                                 {% set displayType = group.displayType %}
  45.                                                 {% if option.media %}
  46.                                                     {% set media = option.media %}
  47.                                                 {% else %}
  48.                                                     {% set media = false %}
  49.                                                 {% endif %}
  50.                                             {% endif %}
  51.                                             {% block page_product_detail_configurator_option %}
  52.                                                 <div class="product-detail-configurator-option">
  53.                                                     {% block page_product_detail_configurator_option_radio %}
  54.                                                         <input type="radio"
  55.                                                                name="{{ group.id }}"
  56.                                                                value="{{ option.id }}"
  57.                                                                class="product-detail-configurator-option-input{% if isCombinableCls %} {{ isCombinableCls }}{% endif %}"
  58.                                                                title="{{ optionIdentifier }}"
  59.                                                                id="{{ optionIdentifier }}"
  60.                                                                {% if isActive %}checked="checked"{% endif %}
  61.                                                                {% if isCombinableCls is empty %}  {% endif %}
  62.                                                                >
  63.                                                         {% block page_product_detail_configurator_option_radio_label %}
  64.                                                             <label class="product-detail-configurator-option-label{% if isCombinableCls %} {{ isCombinableCls }}{% endif %} is-display-{{ displayType }}"
  65.                                                                    {% if displayType == 'color' and option.colorHexCode %}
  66.                                                                    style="background-color: {{ option.colorHexCode }}"
  67.                                                                    {% endif %}
  68.                                                                    title="{{ option.translated.name }}"
  69.                                                                    for="{{ optionIdentifier }}">
  70.                                                                 {% if displayType == 'media' and media %}
  71.                                                                     <img src="{{ media|sw_encode_media_url }}"
  72.                                                                          class="product-detail-configurator-option-image"
  73.                                                                          alt="{{ option.translated.name }}"/>
  74.                                                                 {% elseif displayType == 'text' or
  75.                                                                           (displayType == 'media' and not media) or
  76.                                                                           (displayType == 'color' and not option.colorHexCode) %}
  77.                                                                     {{ option.translated.name }}
  78.                                                                 {% endif %}
  79.                                                             </label>
  80.                                                         {% endblock %}
  81.                                                     {% endblock %}
  82.                                                 </div>
  83.                                             {% endblock %}
  84.                                         {% endfor %}
  85.                                     </div>
  86.                                 {% endblock %}
  87.                             </div>
  88.                         {% endblock %}
  89.                     {% endfor %}
  90.                 {% endblock %}
  91.             </form>
  92.         {% endblock %}
  93.     </div>
  94. {% endblock %}