Just some code for custom category menu navigation. I’m a bit short on time so, no fancy walk trough. All you need to make this show on your page is to call it inside layout file like
HTML Code:
<block type=”core/template” template=”surgeworks/customcatnav.php” />
Filename: customcatnav.php.
PHP Code:
<?php
//Get store id
$storeId = Mage::app()->getStore()->getId();
//Get category model
$_category = Mage::getModel(‘catalog/category’)->setStoreId($storeId);
$_categoryCollection = $_category->getCollection();
$_categoryCollectionIds = $_categoryCollection->getAllIds();
//Remove root category from array
unset($_categoryCollectionIds[0], $_categoryCollectionIds[1]);
?>
<div class=”content”>
<?php
$o = null;
$o .= ‘<dl>’;
foreach ($_categoryCollectionIds as $catId)
{
$_category = $_category->load($catId);
if($_category->getLevel() == 2)
{
$catChildren = $_category->getChildren();
if(!empty($catChildren))
{
$o .= ‘<dt>’.$_category->getName().’</dt>’;
$categoryChildren = explode(“,”, $catChildren);
foreach ($categoryChildren as $categoryChildId)
{
/* @var $_childCategory Mage_Catalog_Model_Category */
$_childCategory = $_category = Mage::getModel(‘catalog/category’)->setStoreId($storeId)->load($categoryChildId);
$o .= ‘<dd>’;
$o .= ‘<span class=”categoryName”><a href=”‘.$_childCategory->getUrl().’”>’.$_childCategory->getName().’</span class=”totalNumberOfProducts”></a>’;
$o .= ‘<span class=”totalNumberOfProducts”>’.$_childCategory->getProductCollection()->count().’</span>’;
$o .= ‘</dd>’;
}
}
}
}
$o .= ‘</dl>’;
echo $o;
?>
</div><?php //content ?>
Bookmarks