custom/plugins/theme/src/Resources/views/storefront/layout/sidebar/category-navigation.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/sidebar/category-navigation.html.twig' %}
  2. {# we start with level 2, level 1 is never used: Einstiegskategorie #}
  3. {# only show children categories #}
  4. {% block layout_navigation_categories_list %}
  5.     {% if activeResult.level == 2 %}
  6.         {% for item in navigationTree %}
  7.             {# display children categories of current category #}
  8.             {% if item.category.id == activeResult.id %}
  9.                 <ul class="category-navigation-wrapper--list">
  10.                     {% for item in item.children %}
  11.                         <li class="category-navigation-entry">
  12.                             <a class="category-navigation-link" href="{{ category_url(item.category) }} {% if category_linknewtab(item.category) %}target="_blank"{% endif %}">
  13.                                 {{ item.category.translated.name }} 
  14.                             </a>
  15.                         </li>
  16.                     {% endfor %}
  17.                 </ul>
  18.             {% endif %}
  19.         {% endfor %}
  20.     {% elseif activeResult.level == 3 %}
  21.         {% for item in navigationTree %}
  22.             {# if category id in active path, go down this category one level to reach the children #}
  23.             {% if item.category.id in activeResult.path %}
  24.                 {# 3. level #}
  25.                 {% for child in item.children %}
  26.                     {% if child.category.id == activeResult.id %}
  27.                         {# if active category has subcategories: show #}
  28.                         {% if child.children %}
  29.                             <ul class="category-navigation-wrapper--list">
  30.                                 {% for item in child.children %}
  31.                                     <li class="category-navigation-entry">
  32.                                         <a class="category-navigation-link" href="{{ category_url(item.category) }}
  33.                                         {% if category_linknewtab(item.category) %}target="_blank"{% endif %}">
  34.                                             {{ item.category.translated.name }}
  35.                                         </a>
  36.                                     </li>
  37.                                 {% endfor %}
  38.                             </ul>
  39.                         {% endif %}
  40.                     {% endif %}
  41.                 {% endfor %}
  42.             {% endif %}
  43.         {% endfor %}
  44.     {% endif %}           
  45. {% endblock %}