Showing posts with label How to get category name by product id magento. Show all posts
Showing posts with label How to get category name by product id magento. Show all posts

Monday, 8 December 2014

Get category name by product id magento


Get category name by product id magento

$product = Mage::getModel('catalog/product')->load($_product->getId());
$cats = $product->getCategoryIds();
foreach($cats as $categoryId) {
    $category = Mage::getModel('catalog/category')->load($categoryId);
    echo $category->getName();
}