/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->getCollection()->getAllIds(); foreach($ids as $id) { if($id != 1) { $cat = Mage::getModel("catalog/category")->load($id); $subcats = $cat->getChildren(); if ($subcats) { ?> <a href="<?php echo $this->getUrl() ?>">Home</a> | <?php { $_category = Mage::getModel('catalog/category')->load($subCatId); if($_category->getIsActive()) { $caturl = $_category->getURL(); $catname = $_category->getName(); echo '<a href="'.$caturl.'" title="'.$catname.'">'.$catname.'</a> |'."\n"; } } ?> <?php } } } ?>
URL: http://www.magentocommerce.com/boards/viewthread/19476/P15/#t273207