Get children categories of rootcategory filtered by storeid magento

//Get children categories of ROOT category filtered by store id magento
include $_SERVER['DOCUMENT_ROOT'].'/app/Mage.php';
echo "<br />Started";

$storeId = 2;
echo "<br />Store id :".Mage::app()->getStore($storeId)->getStoreId();

$root_cat = Mage::app()->getStore($storeId)->getRootCategoryId();
echo "<br />root cat :".$root_cat;
$category_model = Mage::getModel('catalog/category'); //get category model

$categoryid = $root_cat;
$_category = $category_model->load($categoryid); //$categoryid for which the child categories to be found        
$all_child_categories = $category_model->getResource()->getAllChildren($_category); //array consisting of all child categories id
echo '<pre>';
echo '</pre>';
echo "<br />Completed";

Share on Facebook

About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools