So I have the following code in /[my-theme-name]/template/catalog/navigation/left.phtml as a proof of concept:
<?php
$Mage_Catalog_Block_Navigation = new Mage_Catalog_Block_Navigation();
$categories = $Mage_Catalog_Block_Navigation->getStoreCategories();
function render_flat_nav($categories) {
$html = '<ul>';
foreach($categories as $category) {
$html .= '<li><a href="' . $category->getCategoryUrl($cat) . '">' .
$category->getName() . "</a>\n";
if($category->hasChildren()) {
$children = $category->getChildren();
$html .= render_flat_nav($children);
}
$html .= '</li>';
}
return $html . '</ul>';
}
echo render_flat_nav($categories); ?>
It works great for level 0 and level 1 categories but any categories that are more deeply nested are never printed out.
So $category->getChildren() can't quite be returning what I expect it to. Is there a method I can call that will work with my recursive function?
$category->getChildren()returns?getStoreCategories()