Magento has its top menu reserved for category navigation. It’s pretty solid for displaying categories, even when there is a large number of them.
In most of the cases clients want is a vertical == sidebar == category menu. so they can also put sub-categories in it like menu navigation. We can always expand on this, but in most of the cases 3 levels are more than enough for stores.
layout
app/design/frontend/base/default/layout/page.xml
or your theme’s equivalent.
-
getStoreCategories();
Mage::registry('current_category') ? $currentCategoryId = Mage::registry('current_category')->getId() : $currentCategoryId='';
foreach ($storeCategories as $_category):
?>
-
getName(); ?>
getChildren(); ?>
count()) : ?>
-
load($_categoryChild->getId());?>
getChildren(); ?>
- getId() ? $bold="style=\"font-weight:bold\"" : $bold=''; echo ' ' . '' . $_categoryChild->getName() . '(' . $_categoryChildModel->getProductCollection()->count() . ')'; ?> count()) : ?> load($_categoryGrandchild->getId());?>
- getId() ? $bold="style=\"font-weight:bold\"" : $bold=''; echo ' ' . '' . $_categoryGrandchild->getName() . '(' . $_categoryGrandchildModel->getProductCount() . ')'; ?>
This will tell Magento to load our template on each page that sports a layout with a right column.
template file
Create app/design/frontend/base/default/template/page/custom.phtml
with the following content:
See the below image as result: