# HOW TO DISPLAY ONLY CURRENT ACTIVE CATEGORY AND ITS SUB CATEGORY  IN SIDEBAR NAVIGATION?

**URL:** https://forum.shopware.com/t/how-to-display-only-current-active-category-and-its-sub-category-in-sidebar-navigation/62112
**Category:** Programmierung
**Tags:** customelements
**Created:** [2. Oktober 2019 um 13:30 UTC](https://forum.shopware.com/t/how-to-display-only-current-active-category-and-its-sub-category-in-sidebar-navigation/62112 "2019-10-02T13:30:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![iammeet](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@iammeet](https://forum.shopware.com/u/iammeet)
#### Post date: [2. Oktober 2019 um 13:30 UTC](https://forum.shopware.com/t/how-to-display-only-current-active-category-and-its-sub-category-in-sidebar-navigation/62112/1 "2019-10-02T13:30:49Z")

</div>

**1. MainCategory**

**-SubCategory1**

**–Children1**

**–Children2**

**-SubCategory2**

**–Children1**

**–Children2**

**-Children3**

**2. MainCategory**

**-SubCategory1**

**–Children1**

**–Children2**

**-SubCategory2**

**–Children1**

**3. MainCategory**

**-SubCategory1**

**–Children1**

```
 {\* Maincategories left \*} {function name=categories level=0} 

```

{block name=“frontend\_index\_categories\_left\_before”}{/block} {foreach $categories as $category} {block name=“frontend\_index\_categories\_left\_entry”} - {$category.description} {if $category.childrenCount} {/if} {block name=“frontend\_index\_categories\_left\_entry\_subcategories”} {if $category.subcategories} {call name=categories categories=$category.subcategories level=$level+1} {/if} {/block}  
{/block} {/foreach} {block name=“frontend\_index\_categories\_left\_after”}{/block} {/function} {if $sCategories} {call name=categories categories=$sCategories} {elseif $sMainCategories} {call name=categories categories=$sMainCategories} {/if}

&nbsp;
