I have the following menu/category structure in my store:
root
|
products
| | |
cars bikes vans
| | |
bmw carrera fiat
audi apollo ford
ford raleigh
lexus voodoo
tvr
I need to be able to access just the subcategories of products
subcategories as a collection.
So my page would access that collection and output a simple list like this:
bmw
audi
ford
lexus
tvr
carrera
apollo
raleigh
voodoo
fiat
ford
I can get products
subcategories in a collection like below but how do I get the subcategories of them?
$category = Mage::getModel('catalog/category')->load($the_id);
$categories = $category->getCollection()
->addAttributeToSelect(array('name', 'thumbnail'))
->addAttributeToFilter('is_active', 1)
->addIdFilter($category->getChildren())
<ul>
<?php
foreach ($categories as $category): ?>
<li><?php echo $category->getName() ?></li>
<?php endforeach; ?>
</ul>