custom/plugins/FourtwosixThemeExtension/src/Resources/views/storefront/element/fourtwosix-current-category-navigation.html.twig line 1

Open in your IDE?
  1. {% block layout_navigation_categories_list %}
  2.     {% if not active %}
  3.         {% set active = page.header.navigation.active %}
  4.     {% endif %}
  5.     {% if not mainCategory %}
  6.         {% set mainCategory = page.header.navigation.tree[active.id] %}
  7.         {% if mainCategory == null %}
  8.             {% if active.level <= 3 %}
  9.                 {% set mainCategory = page.header.navigation.tree[active.parentId].children[active.id] %}
  10.                 {% set level = 1 %}
  11.             {% elseif active.level != 5 %}
  12.                 {% set path = active.path|split("|") %}
  13.                 {% set mainCategory = page.header.navigation.tree[path[2]].children[active.parentId].children[active.id] %}
  14.             {% else %}
  15.                 {% set mainCategory = active %}
  16.             {% endif %}
  17.         {% endif %}
  18.     {% endif %}
  19.     {% set navigationMaxDepth = context.salesChannel.navigationCategoryDepth %}
  20.     {% if not level %}
  21.         {% set level = 0 %}
  22.     {% endif %}
  23.     <div class="category-navigation-box d-none d-lg-block">
  24.         <div class="category-navigation-entry list-style-type-none">
  25.             <a class="category-navigation-link in-path has-children"
  26.                href="  {{ category_url(category in mainCategory ? mainCategory.category : active) }}" {% if category_linknewtab(category in mainCategory ? mainCategory.category : active) %} target="_blank" {% endif %} >
  27.                 <span class=" category-navigation-link-inner">{{ "fts.subcategories"|trans }}</span>
  28.                 {% if theme_config('zen-sidebar-navigation-arrow') and level == 0 and mainCategory.children %}
  29.                     {% sw_icon 'arrow-medium-down' style {
  30.                         'pack': 'solid', 'size': 'xs', 'class': 'category-navigation-link-toggle'
  31.                     } %}
  32.                 {% endif %}
  33.             </a>
  34.             <ul class="category-navigation level-1">
  35.                 {% if active.childcount > 0 %}
  36.                     {# @fourtwosix-edit 1203743631835637-1205705578080544 sort by name #}
  37.                     {% set childCategories = mainCategory.children|sort((a,b) => a.category.translated.name <=> b.category.translated.name) %}
  38.                     {% for childCategory in childCategories %}
  39.                         {% if level > 0 %}
  40.                             <li class="category-navigation-entry">
  41.                                     <a class="category-navigation-link{% if active.id == childCategory.id %} is-active{% endif %}"
  42.                                        href="{{ category_url(childCategory.category) }}" {% if category_linknewtab(childCategory.category) %} target="_blank" {% endif %}>
  43.                                         <span class="category-navigation-link-inner">{{ childCategory.category.translated.name }}</span>
  44.                                     </a>
  45.                             </li>
  46.                         {% else %}
  47.                             <li class="category-navigation-entry">
  48.                                 <a class="category-navigation-link{% if active.id == childCategory.id %} is-active{% endif %}"
  49.                                    href="{{ category_url(childCategory.category) }}" {% if category_linknewtab(childCategory.category) %} target="_blank" {% endif %}>
  50.                                     <span class="category-navigation-link-inner">{{ childCategory.category.translated.name }}</span>
  51.                                 </a>
  52.                             </li>
  53.                         {% endif %}
  54.                     {% endfor %}
  55.                 {% else %}
  56.                     <li class="category-navigation-entry">
  57.                         <a class="category-navigation-link is-active"
  58.                            href="{{ category_url(active) }}" {% if category_linknewtab(active) %} target="_blank" {% endif %}>
  59.                             <span class="category-navigation-link-inner">{{ active.translated.name }}</span>
  60.                         </a>
  61.                     </li>
  62.                 {% endif %}
  63.             </ul>
  64.         </div>
  65.     </div>
  66. {% endblock %}