custom/plugins/ChespackTheme/src/Resources/views/storefront/component/sorting.html.twig line 1

Open in your IDE?
  1. {% set config = { sorting: current } %}
  2. {% set showSorting = (slot.config.showSorting.value is defined) ? slot.config.showSorting.value : true %}
  3. {% if showSorting and sortings|length > 1 %}
  4.     <div class="sorting custom-select-wrap" data-listing-sorting="true" data-listing-sorting-options='{{ config|json_encode }}'>
  5.         <label>{{ "chespackTheme.category.sortBy"|trans|sw_sanitize }}</label>
  6.         <select class="sorting custom-select" aria-label="{{ 'general.sortingLabel'|trans|striptags }}">
  7.             {% for sorting in sortings %}
  8.                 {% set key = sorting.key %}
  9.                 <option value="{{ key }}"{% if key == current %} selected{% endif %}>{{ sorting.translated.label|sw_sanitize }}</option>
  10.             {% endfor %}
  11.         </select>
  12.     </div>
  13. {% endif %}
  14. {# Add products counter #}
  15. {% if controllerName == 'Search' %}
  16.     {% set listing = page.listing %}
  17. {% else %}
  18.     {% set listing = slot.data.listing %}
  19. {% endif %}
  20. {% if listing.total > 0 %}
  21.     {% block element_product_listing_count %}
  22.         {# TODO: update counter on sorting or filter change #}
  23.         <div class="products-counter" data-products-counter="true">
  24.             {{ "chespackTheme.category.counter"|trans({
  25.                 '%items%': listing.elements|length,
  26.                 '%total%': listing.total
  27.             })|raw }}
  28.         </div>
  29.     {% endblock %}
  30. {% endif %}