Create Dynamic Lists
- Create a Category Tree using the formatted Excel file named (examplecategorytree.xls)
- Import the excel spreadsheet by logging into the admin and going to the Catalog >
Categories > Import (AEM Only) from the Categories
section of the left bar.
- Assigning the dynamic category – If you are creating the main navigation to the site, you will not need to
enter a category Parent ID.
Note: If you are assigning the category tree to a pre-existing category/subcategory, you will need to enter the id here in the field labeled ‘Parent ID’. Importing to the chosen ID will allow the categories to be built under the selected location.
- Choose the file and select “Upload File”
Below is the portion that shows the top bar items with both dynamic and not dynamic (polarized)
<li id="li-cat_30" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Motorsport</a></li>
<li id="li-cat_37" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Lifestyle</a></li> <li id="li-cat_42" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Sports</a></li> <li><a href="/category/56/Polarized.html">Polarized</a></li> <li id="li-cat_46" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Goggles</a></li> <li id="li-cat_49" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Accessories</a></li>
Insert this script, below the section that shows the Top Bar Items by name of the Layout -> Top Bar -> HTML Code
<script language="javascript">
document.getElementById("li-cat_30").appendChild(document.getElementById("ul-cat_30"));
document.getElementById("li-cat_37").appendChild(document.getElementById("ul-cat_37"));
document.getElementById("li-cat_42").appendChild(document.getElementById("ul-cat_42"));
document.getElementById("li-cat_46").appendChild(document.getElementById("ul-cat_46"));
document.getElementById("li-cat_49").appendChild(document.getElementById("ul-cat_49"));
</script>
Make the “li-cat_##” and the “ul-cat_##” the Category ID of the top bar
Direct link to this Question: