Reputation: 1672
I'm using Magento with an horizontal menu. This menu shows all parent categories. What I want is to show the subcategories of the clicked parent category.
How can i realise this?
Thanks in advance!
Upvotes: 0
Views: 1258
Reputation: 2004
You can use the following code in order to get sub-categories in the parent category page:
<?php
$parentCategory = Mage::registry('current_category');
if($parentCategory){
$catId = $parentCategory->getId();
$category = Mage::getModel('catalog/category')->load($catId);
$childCategories = $category->getChildrenCategories();
foreach($childCategories as $_category){
print_r($_category->getData());
}
}
Hope this helps.
Thanks
Upvotes: 1