templates/includes/product/product-content.html.twig line 1

Open in your IDE?
  1. {% set specialTeaser = document.getProperty('specialTeaser') %}
  2. {% if products|length and products|first is instanceof('\\Pimcore\\Model\\DataObject\\Product') %}
  3.     {{ include('includes/product/product-filter.html.twig', {
  4.         'products': products,
  5.         'categories': categories|default([]),
  6.     }) }}
  7. {% else %}
  8.     {{ include('includes/product/product-filter-used.html.twig', {
  9.         'products': products,
  10.         'categories': categories|default([]),
  11.         'brands': brands|default([]),
  12.         'countries': countries|default([]),
  13.         'workingHourMin': workingHourMin|default([]),
  14.         'workingHourMax': workingHourMax|default([]),
  15.         'yearOfManufactureMin': yearOfManufactureMin|default([]),
  16.         'yearOfManufactureMax': yearOfManufactureMax|default([]),
  17.         'engineTypes': engineTypes|default([]),
  18.         'capacityMin': capacityMin|default([]),
  19.         'capacityMax': capacityMax|default([]),
  20.     }) }}
  21. {% endif %}
  22. <div class="js-product-grid__content">
  23.     <div class="js-product-grid-quick-filter__template" hidden>
  24.         <li class="list-inline-item">
  25.             <button type="button" class="js-product-grid-quick-filter__item product-grid-quick-filter__item">
  26.                 <span class="js-product-grid-quick-filter__text"></span>
  27.                 <span class="icon icon-x product-grid-quick-filter__remove" aria-label="{{ 'global.filter.remove'|trans }}"></span>
  28.             </button>
  29.         </li>
  30.     </div>
  31.     <ul class="my-4 list-md-inline list-unstyled d-md-flex align-items-center">
  32.         <li class="list-inline-item">
  33.             <ul class="js-product-grid-quick-filter my-4 list-inline">
  34.                 <!-- content is append with JS -->
  35.             </ul>
  36.         </li>
  37.       
  38.         <li class="list-inline-item">
  39.             <button class="align-items-center js-product-grid__remove-input btn-no-styling product-grid-quick-filter__remove-btn js-product-grid-quick-filter__remove-all" type="reset" data-name="*" hidden>
  40.                 <span class="icon icon-delete product-grid-quick-filter__remove-btn-icon" aria-label="{{ 'global.filter.RemoveAllFilters'|trans }}"></span>
  41.                 <span class="product-grid-quick-filter__remove-btn-text">{{ 'global.filter.RemoveAllFilters'|trans }}</span>
  42.             </button>
  43.         </li>
  44.     </ul>
  45.     <div class="row gy-2">
  46.         {% set length = products|length %}
  47.         {% set specialTeaserIndex = 3 %}
  48.         {% if length < 4 %}
  49.             {% set specialTeaserIndex = length %}
  50.         {% endif %}
  51.         {% for product in products %}
  52.             <div class="col-xl-3 col-md-6">
  53.                 {{ _self.renderProductTeaser(product) }}
  54.             </div>
  55.             {% if specialTeaser and specialTeaserIndex == loop.index %}
  56.                 <div class="col-xl-3 col-md-6">
  57.                     {{ pimcore_inc(specialTeaser) }}
  58.                 </div>
  59.             {% endif %}
  60.         {% endfor %}
  61.         {% if length == 0 %}
  62.             {{ include('includes/atoms/no-results.html.twig') }}
  63.         {% endif %}
  64.     </div>
  65. </div>
  66. {% macro renderProductTeaser(product) %}
  67.     {% if product is instanceof('\\Pimcore\\Model\\DataObject\\Product') %}
  68.         {% set teaserType = 'product' %}
  69.     {% elseif product is instanceof('\\Pimcore\\Model\\DataObject\\MascusProduct') %}
  70.         {% set teaserType = 'mascusProduct' %}
  71.     {% elseif product is instanceof('\\Pimcore\\Model\\DataObject\\Forklift') %}
  72.         {% set teaserType = 'forklift' %}
  73.     {% endif %}
  74.     {{ include('includes/teaser/products-teaser-'"#{teaserType}"'.html.twig', {
  75.         'product': product,
  76.     }) }}
  77. {% endmacro %}