Sunday, July 8, 2012

How to get all subcategory details of current category in magento?

function fnGetSubCategories($intParentCategoryId) { $objData = Mage::getSingleton('core/resource')->getConnection('core_write'); $sqlQuery = " SELECT distinct(cce.entity_id) FROM catalog_category_entity cce INNER JOIN catalog_category_entity_int ccei ON cce.entity_id = ccei.entity_id WHERE cce.parent_id = '".$intParentCategoryId."' AND ccei.attribute_id = 119 AND ccei.value = 1 ORDER BY cce.position ASC"; $arrSubCategories = array(); $resSubcategories = $objData->query($sqlQuery); $arrAllSubcategories = $resSubcategories->fetchAll(PDO::FETCH_ASSOC); if(count($arrAllSubcategories)) { foreach($arrAllSubcategories as $aSubCat) { $arrSubCategories[] = $aSubCat['entity_id']; } } return $arrSubCategories;
}

No comments:

Post a Comment

Please mention your comments.......