In Magento default the "top.phtml" file shows all category and sub category. can access all category and subcategory in magento by editing "top.phtml"
Here is the location for "top.phtml"
app/design/frontend/your-package/your-theme/template/catalog/navigation/top.phtml
For that we will write the code in top.phtml file
Here is the location for "top.phtml"
app/design/frontend/your-package/your-theme/template/catalog/navigation/top.phtml
For that we will write the code in top.phtml file
<?php foreach ($this->getStoreCategories() as $_category): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a>
<?php
$_catid=$_category->getId();
$category = Mage::getModel('catalog/category')->load($_catid);
$subcategory = $category->getAllChildren(true);
array_shift($subcategory);
if($subcategory!=null)
{?>
<ul>
<?php
foreach ($subcategory as $sub)
{
$sub1 = Mage::getModel('catalog/category')->load( $sub);
?>
<li><a href="<?php echo $sub1->getUrl();?>"><span>
<?php echo $sub1->getName(); ?>
</span></a></li>
<?php } ?>
</ul>
<?php }?>
</li>
<?php endforeach ?>


Magento eCommerce site is future rich and It's have more eCommerce facility and you can easily and very fast searches. Magento Developers
ReplyDelete