{% block layout_navigation_categories_list %}
{% if not active %}
{% set active = page.header.navigation.active %}
{% endif %}
{% if not mainCategory %}
{% set mainCategory = page.header.navigation.tree[active.id] %}
{% if mainCategory == null %}
{% if active.level <= 3 %}
{% set mainCategory = page.header.navigation.tree[active.parentId].children[active.id] %}
{% set level = 1 %}
{% elseif active.level != 5 %}
{% set path = active.path|split("|") %}
{% set mainCategory = page.header.navigation.tree[path[2]].children[active.parentId].children[active.id] %}
{% else %}
{% set mainCategory = active %}
{% endif %}
{% endif %}
{% endif %}
{% set navigationMaxDepth = context.salesChannel.navigationCategoryDepth %}
{% if not level %}
{% set level = 0 %}
{% endif %}
<div class="category-navigation-box d-none d-lg-block">
<div class="category-navigation-entry list-style-type-none">
<a class="category-navigation-link in-path has-children"
href=" {{ category_url(category in mainCategory ? mainCategory.category : active) }}" {% if category_linknewtab(category in mainCategory ? mainCategory.category : active) %} target="_blank" {% endif %} >
<span class=" category-navigation-link-inner">{{ "fts.subcategories"|trans }}</span>
{% if theme_config('zen-sidebar-navigation-arrow') and level == 0 and mainCategory.children %}
{% sw_icon 'arrow-medium-down' style {
'pack': 'solid', 'size': 'xs', 'class': 'category-navigation-link-toggle'
} %}
{% endif %}
</a>
<ul class="category-navigation level-1">
{% if active.childcount > 0 %}
{# @fourtwosix-edit 1203743631835637-1205705578080544 sort by name #}
{% set childCategories = mainCategory.children|sort((a,b) => a.category.translated.name <=> b.category.translated.name) %}
{% for childCategory in childCategories %}
{% if level > 0 %}
<li class="category-navigation-entry">
<a class="category-navigation-link{% if active.id == childCategory.id %} is-active{% endif %}"
href="{{ category_url(childCategory.category) }}" {% if category_linknewtab(childCategory.category) %} target="_blank" {% endif %}>
<span class="category-navigation-link-inner">{{ childCategory.category.translated.name }}</span>
</a>
</li>
{% else %}
<li class="category-navigation-entry">
<a class="category-navigation-link{% if active.id == childCategory.id %} is-active{% endif %}"
href="{{ category_url(childCategory.category) }}" {% if category_linknewtab(childCategory.category) %} target="_blank" {% endif %}>
<span class="category-navigation-link-inner">{{ childCategory.category.translated.name }}</span>
</a>
</li>
{% endif %}
{% endfor %}
{% else %}
<li class="category-navigation-entry">
<a class="category-navigation-link is-active"
href="{{ category_url(active) }}" {% if category_linknewtab(active) %} target="_blank" {% endif %}>
<span class="category-navigation-link-inner">{{ active.translated.name }}</span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endblock %}