To preface this question, I am a front-end developer with limited knowledge of php. I am attempting to show all categories and sub-categories on the left navigation in Magento. I created a phtml file using a method I found on GitHub. This works great to pull in the top level of categories but I want to show the subcategories too. Here's the code I have now:
<?php $_categories=$this->getCurrentChildCategories() ?>
<?php if($_categories->count()): ?>
<ul class="category-links">
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li class="<?php echo $this->htmlEscape($_category->getUrlKey()) ?>">
<a href="<?php echo $this->getCategoryUrl($_category) ?>">
<?php echo $this->htmlEscape($_category->getName()) ?>
</a>
</li>
<?php endif; ?>
<?php endforeach ?>
</ul>
<? endif; ?>
This pulls in the categories like this:
Category 1 Category 2 Category 3
But what I want is this
Category 1 Subcategory 1 of Category 1 Subcategory 2 of Category 1 Category 2 Subcategory 1 of Category 2 Subcategory 2 of Category 2
and so on...
Can anyone help me with this?
Thanks so much!