<?php
require_once ‘app/Mage.php’;
Mage::app();
$category = Mage::getModel(‘catalog/category’);
$tree = $category->getTreeModel();
$tree->load();
$ids = $tree->getCollection()->getAllIds(); // we can get all level categories id
if ($ids):
foreach ($ids as $id){
$cat = Mage::getModel(‘catalog/category’);
$cat->load($id);
if($id != 3): // if category id is not “root catalog” id – here root catalog id is 3
if($cat->getIsActive()): // if category is active
$catName[] = $cat->getName(); // To get name of the category
$path[] = $cat->getUrl(); // to get url of category
endif;
endif;
}
?>
January 12, 2010
Subscribe to:
Post Comments (Atom)
Thanx Nimesh,
ReplyDeleteThis is exactly what I am looking for.
thanx once again.
Anand Singh