Home » Magento

Magento: Get current and parent category

22 December 2009 Share/Bookmark

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());

From Mukesh Chapagain's Blog, post Magento: Get current and parent category

email

php magento mukesh chapagain

Get New Post by Email
RSS Feed Subscribe RSS Feed
  • Vishalsanwar

    HI,

    How to  Get current and parent category in a colllection in admin section ???

    Thanx
    Vishal