Magento: Get current and parent category
You can get current category from the following code:
$currentCategory = Mage::registry('current_category');
You can get the parent category from the following code:
/**
* You want the parent category of a sub-category
* Let the sub-category be $subCategory
*/
$parentCategory = Mage::getModel('catalog/category')->load($subCategory->getParentId());
Related posts:
- Magento: Get category name and url from product
- Magento: How to filter product collection using 2 or more category filters?
- Magento 1.4: No products displayed in category listing
- Magento: Get Bestselling products by category and date time
- Magento: Adding category attributes
- Magento: Get parent id of simple product associated to configurable product
- Magento: Get sub categories and product count
- Magento: Convert Price from Current Currency to Base Currency and vice-versa
- Magento: Get current Url of the page
- How to show child page (sub page) list in parent page in wordpress?
