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

Open in your IDE?
  1. {% sw_extends '@parent/storefront/page/product-detail/properties.html.twig' %}
  2. {% block page_product_detail_properties_inner %}
  3.     <div class="product-detail-properties">
  4.         {% block page_product_detail_properties_container %}
  5.             <div class="row product-detail-properties-container">
  6.                 <div class="col-12">
  7.                     {# Variables will be set when this file is used inside oo-specifications #}
  8.                     {% set condition = element.config.showMoreRenderCondition.value|default(false) %}
  9.                     {% set limit = element.config.renderLimit.value|number_format %}
  10.                     {% set limit = limit < 1 ? 9999 : limit %}
  11.                     {% set limitExeeded = page.product.sortedProperties|length > limit %}
  12.                     {% set showMore = condition == 'always' ? true 
  13.                                     : condition == 'never' ? false 
  14.                                     : condition == 'default' ? limitExeeded 
  15.                                     : false
  16.                     %}
  17.                     {% set showMoreLink = element.config.showMoreLink.value|default('#') %}
  18.                     {% block page_product_detail_properties_table %}
  19.                         <table class="table table-striped product-detail-properties-table">
  20.                             <tbody>
  21.                                 {# Keep track of things that are printed #}
  22.                                 {% set printedItems = [] %}
  23.                                 {% set printedGroups = [] %}
  24.                                 
  25.                                 {# Print items that should be printed at top (ignoring the 'printgroup') #}
  26.                                 {% set topItems = page.product.sortedProperties.elements|filter(e => e.translated.customFields.custom_attributes_show_on_top == '1') %}
  27.                                 {% for item in topItems %}
  28.                                     {% set withinItemLimit = printedItems|length < limit %}
  29.                                     {% if withinItemLimit %} 
  30.                                         {% sw_include '@Storefront/storefront/page/product-detail/property.html.twig' with {
  31.                                             group: item,
  32.                                             additionalClass: 'top-item'
  33.                                         } %}
  34.                                     {% endif %}
  35.                                     {# Add item to printeditems #}
  36.                                     {% set printedItems = printedItems|merge([item.id]) %}
  37.                                 {% endfor %}
  38.                                 
  39.                                 {# Print items that are not printed at top #}
  40.                                 {% set normalItems = page.product.sortedProperties.elements %}
  41.                                 {# |filter(e => e.id not in printedItems) %} #}
  42.                                 {% for group in normalItems|sort((a, b) => a.translated.customFields.custom_attributes_category <=> b.translated.customFields.custom_attributes_category) %}
  43.                                     {% set withinItemLimit = printedItems|length < limit %}
  44.                                     {% if withinItemLimit %}
  45.                                         {% set hasAttributeGroup = (group.translated.customFields.custom_attributes_category is not empty)|default(false) %} 
  46.                                         {% set attributeGroup = hasAttributeGroup ? group.translated.customFields.custom_attributes_category : '' %}
  47.                                         {% set first = attributeGroup not in printedGroups %}
  48.                                         {% set printedGroups = printedGroups|merge([attributeGroup]) %}
  49.                                         {# Print groupname before first item within the group #}
  50.                                         {% if hasAttributeGroup && first %}
  51.                                             <tr class="attributegroup-row"><td colspan="2" class="pt-4">{{attributeGroup}}</td></tr>
  52.                                         {% endif %}
  53.                                         {% sw_include '@Storefront/storefront/page/product-detail/property.html.twig' with {
  54.                                             group: group,
  55.                                             additionalClass: 'regular-item'
  56.                                         } %}
  57.                                     {% endif %}
  58.                                     {# Add item to printeditems #}
  59.                                     {% set printedItems = printedItems|merge([group.id]) %}
  60.                                 {% endfor %}
  61.                                 {% if showMore %}
  62.                                     <tr class="showmore-row"><td colspan="2"><a href="{{ showMoreLink }}">Toon meer</a></td></tr>
  63.                                 {% endif %}
  64.                             </tbody>
  65.                         </table>
  66.                     {% endblock %}
  67.                 </div>
  68.             </div>
  69.         {% endblock %}
  70.     </div>
  71. {% endblock %}