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

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/properties.html.twig' %}
  2. {% set customFields = (page.product.customFields|default({}))|merge(page.product.translated.customFields|default({})) %}
  3. {% set hidePropertiesContainerValue = customFields.itp_hide_properties_container ?? customFields.itp_hide_properties_container_ ?? false %}
  4. {% set hidePropertiesContainerEnabled = hidePropertiesContainerValue in [true, 1, '1', 'true', 'on', 'yes'] %}
  5. {% block page_product_detail_properties_inner %}
  6.     {% if not hidePropertiesContainerEnabled %}
  7.         <div class="product-detail-properties">
  8.             {% block page_product_detail_properties_container %}
  9.                 <div class="row product-detail-properties-container">
  10.                     <div class="col-md-12 col-lg-6">
  11.                         {% block page_product_detail_properties_table %}
  12.                             <table class="table table-striped product-detail-properties-table">
  13.                                 <tbody>
  14.                             {% set thread = page.product.sortedProperties.first %}
  15.                             <tr class="properties-row">
  16.                                 {% block page_product_detail_propertie_thread_item_label %}
  17.                                     <th class="properties-label">{{ thread.translated.name|e }}:</th>
  18.                                 {% endblock %}
  19.                                 {% block page_product_detail_propertie_thread_item_value %}
  20.                                     <td class="properties-value">
  21.                                         {% apply spaceless %}
  22.                                             {% for option in thread.options %}
  23.                                                 {% set i = ( i | default(0) ) + 1 %}
  24.                                                 <span>{% if i > 1 %}, {% endif %}{{ option.translated.name|e }}</span>
  25.                                             {% endfor %}
  26.                                         {% endapply %}
  27.                                     </td>
  28.                                 {% endblock %}
  29.                             </tr>
  30.                             {# Black list for these custom fields to be never displayed #}
  31.                             {% set blacklist = [
  32.                                 'itp_hide_properties_container',
  33.                                 'itp_hide_properties_container_',
  34.                                 'itp_product_attributes_shop_de',
  35.                                 'itp_product_attributes_shop_us',
  36.                                 'itp_product_attributes_text2_de',
  37.                                 'itp_product_attributes_text2_en',
  38.                                 'itp_product_attributes_order_number',
  39.                                 'itp_product_attributes_chemically_resistant',
  40.                                 'extended_itp_skus',
  41.                                 'show_extended_itp_skus',
  42.                                 'itp_product_attributes_zeiss_no_2',
  43.                                 'itp_product_attributes_certificate',
  44.                                 'custom_cio_tetra_not_discountable'
  45.                             ] %}
  46.                             {# Allow list for these custom fields to be displayed at the bottom of the list #}
  47.                             {% set bottomCustomFields = [
  48.                                 'itp_product_attributes_zeiss_no',
  49.                                 'itp_product_attributes_renishaw_no',
  50.                                 'itp_product_attributes_carbide_no',
  51.                                 'itp_product_attributes_qmark_no',
  52.                                 'itp_product_attributes_blum_no',
  53.                                 'itp_product_attributes_hexagon_no',
  54.                                 'itp_product_attributes_mitutoyo_no',
  55.                                 'itp_product_attributes_klingenberg_no',
  56.                                 'itp_product_attributes_heidenhain_no',
  57.                                 'itp_product_attributes_faro_no',
  58.                                 'itp_product_attributes_marpos_no',
  59.                                 'itp_product_attributes_goekler_no'
  60.                             ] %}
  61.                             {# CIO-AI-Driven: Bool-ähnliche CustomFields explizit als Ja/Nein rendern #}
  62.                             {% set booleanCustomFields = [
  63.                                 'itp_product_attributes_compatible_with_cnc'
  64.                             ] %}
  65.                             {% for key, customField in customFields %}
  66.                                 {% set isTruthy = customField in [true, 1, '1', 'true', 'on', 'yes'] %}
  67.                                 {% set showRow = key not in booleanCustomFields or isTruthy %}
  68.                                 {% if customField is not null and key not in blacklist and key not in bottomCustomFields and showRow %}
  69.                                  {% set transName = "customFields." ~ key %}
  70.                                      <tr class="properties-row">
  71.                                         <th class="properties-label">{{ transName|trans|sw_sanitize }}:
  72.                                          </th>
  73.                                         <td class="properties-value">
  74.                                             {% if key in booleanCustomFields %}
  75.                                                 {{ "yes"|trans|sw_sanitize }}
  76.                                             {% elseif customField matches '/^\\d+$/' %}
  77.                                                 <span>{{ customField|number_format(1, '.', ',') }}</span>
  78.                                             {% else %}
  79.                                                 <span>{{ customField }}</span>
  80.                                             {% endif %}
  81.                                         </td>
  82.                                     </tr>
  83.                                 {% endif %}
  84.                             {% endfor %}
  85.                             {% for group in page.product.sortedProperties %}
  86.                                 {% set position = group.translated.position ?? group.position ?? 0 %}
  87.                                 {% if not loop.first and position < 90 %}
  88.                                     <tr class="properties-row">
  89.                                         <th class="properties-label">{{ group.translated.name|e }}:</th>
  90.                                         <td class="properties-value">
  91.                                             {% apply spaceless %}
  92.                                                 {% for option in group.options %}
  93.                                                     {% set i = ( i | default(0) ) + 1 %}
  94.                                                     <span>{% if i > 1 %}, {% endif %}{{ option.translated.name|e }}</span>
  95.                                                 {% endfor %}
  96.                                             {% endapply %}
  97.                                         </td>
  98.                                     </tr>
  99.                                 {% endif %}
  100.                             {% endfor %}
  101.                             {% if page.product.weight is not null %}
  102.                                 <tr class="properties-row">
  103.                                     {% block page_product_detail_propertie_weight_item_label %}
  104.                                         <th class="properties-label">{{ "component.product.feature.label.weight"|trans }}</th>
  105.                                     {% endblock %}
  106.                                     {% block page_product_detail_propertie_weight_item_value %}
  107.                                         <td class="properties-value"><span>{{ page.product.weight }}</span></td>
  108.                                     {% endblock %}
  109.                                 </tr>
  110.                             {% endif %}
  111.                             {# Properties with position >= 90 (displayed after weight) #}
  112.                             {% for group in page.product.sortedProperties %}
  113.                                 {% set position = group.translated.position ?? group.position ?? 0 %}
  114.                                 {% if position >= 90 %}
  115.                                     <tr class="properties-row">
  116.                                         <th class="properties-label">{{ group.translated.name|e }}:</th>
  117.                                         <td class="properties-value">
  118.                                             {% apply spaceless %}
  119.                                                 {% for option in group.options %}
  120.                                                     {% set i = ( i | default(0) ) + 1 %}
  121.                                                     <span>{% if i > 1 %}, {% endif %}{{ option.translated.name|e }}</span>
  122.                                                 {% endfor %}
  123.                                             {% endapply %}
  124.                                         </td>
  125.                                     </tr>
  126.                                 {% endif %}
  127.                             {% endfor %}
  128.                             {% for key, customField in customFields %}
  129.                                 {% if customField is not null and key in bottomCustomFields %}
  130.                                     {% set transName = "customFields." ~ key %}
  131.                                     <tr class="properties-row">
  132.                                         <th class="properties-label">{{ transName|trans|sw_sanitize }}:
  133.                                         </th>
  134.                                         <td class="properties-value">
  135.                                             <span>{{ customField }}</span>
  136.                                         </td>
  137.                                     </tr>
  138.                                 {% endif %}
  139.                             {% endfor %}
  140.                                 </tbody>
  141.                             </table>
  142.                         {% endblock %}
  143.                     </div>
  144.                 {% block itp_us_second_product_image %}
  145.                     {% set images = page.product.media.elements %}
  146.                     {% if images|length > 1 %}
  147.                         {% set image = images|slice(1, 1)|first %}
  148.                         <div class="col-md-12 col-lg-4 text-center">
  149.                             {% set altAndTitle = "detail.altTitleTagDrawing"|trans ~ page.product.translated.name %}
  150.                             {% set attributes = {
  151.                                 'class': 'img-fluid product-detail-properties-image',
  152.                                 'alt': altAndTitle,
  153.                                 'title': altAndTitle ,
  154.                                 'data-full-image': image.url
  155.                             } %}
  156.                             {% if displayMode == 'cover' or displayMode == 'contain' %}
  157.                                 {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  158.                             {% endif %}
  159.                             {% if isProduct %}
  160.                                 {% set attributes = attributes|merge({ 'itemprop': 'image' }) %}
  161.                             {% endif %}
  162.                             {% sw_thumbnails 'gallery-slider-image-thumbnails' with {
  163.                                 media: image.media
  164.                             } %}
  165.                         </div>
  166.                     {% endif %}
  167.                 {% endblock %}
  168.                 </div>
  169.             {% endblock %}
  170.         </div>
  171.     {% endif %}
  172. {% endblock %}