custom/plugins/MoorlFoundation/src/Resources/views/storefront/page/search/index.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/search/index.html.twig' %}
  2. {% block page_search %}
  3.     {% if page.listing.moorlSearchResults and page.listing.moorlSearchResults|length > 0 %}
  4.         {# Has advanced search results - Load tabs #}
  5.         {% set activeTab = "product" %}
  6.         {% set count = page.listing.total %}
  7.         {% if app.request.query.get('tab') %}
  8.             {% set activeTab = app.request.query.get('tab') %}
  9.         {% endif %}
  10.         {% for moorlSearchResult in page.listing.moorlSearchResults %}
  11.             {% if moorlSearchResult.criteria.title == activeTab %}
  12.                 {% set count = moorlSearchResult.total %}
  13.             {% endif %}
  14.         {% endfor %}
  15.         <div class="cms-page search-page moorl-search-page">
  16.             <h1 class="search-headline">
  17.                 {{ "moorl-foundation.search.headline"|trans({
  18.                     '%count%': count,
  19.                     '%searchTerm%': page.searchTerm,
  20.                 }) }}
  21.             </h1>
  22.             <ul class="nav nav-tabs">
  23.                 <li class="nav-item">
  24.                     <a class="nav-link{% if activeTab == "product" %} active{% endif %}"
  25.                        href="{{ path('frontend.search.page') }}?search={{ page.searchTerm }}">
  26.                         {{ "moorl-foundation.search.product"|trans }}
  27.                         <span class="badge badge-primary">{{ page.listing.total }}</span>
  28.                     </a>
  29.                 </li>
  30.                 {% for moorlSearchResult in page.listing.moorlSearchResults %}
  31.                     <li class="nav-item">
  32.                         <a href="{{ path('frontend.search.page') }}?search={{ page.searchTerm }}&tab={{ moorlSearchResult.criteria.title }}"
  33.                            class="nav-link{% if activeTab == moorlSearchResult.criteria.title %} active{% endif %}">
  34.                             {{ moorlSearchResult.snippet|trans }}
  35.                             <span class="badge badge-primary">{{ moorlSearchResult.total }}</span>
  36.                         </a>
  37.                     </li>
  38.                 {% endfor %}
  39.             </ul>
  40.             <div class="tab-content">
  41.                 {# Search page #}
  42.                 {% sw_include '@Storefront/storefront/page/search/search-pagelet.html.twig' %}
  43.             </div>
  44.         </div>
  45.     {% else %}
  46.         {# Do nothing #}
  47.         {{ parent() }}
  48.     {% endif %}
  49. {% endblock %}