Thursday, 15 September 2016

How to get Category Id of current product in magento

$categoryIds = $_product->getCategoryIds();      
            if(count($categoryIds) ){
                $firstCategoryId = $categoryIds[0];
                $_category = Mage::getModel('catalog/category')->load($firstCategoryId);

                echo $_category->getName();
               echo $_category->getId();
            }

No comments:

Post a Comment