如何在 Magento 中通过类别 ID 获取类别名称

How to get category name by category id in Magento

如何在分类页面的magento中通过分类ID获取分类名称? 提前致谢,请给我建议。

在类别页面上,您可以获得这样的信息:

$category = Mage::registry('current_category');
echo $category->getName();

请按类别 ID 使用以下代码作为类别名称。还获取缩略图等

$categoryId = 5;    // Change category id according to you or use dynamic category variable

// display name and other detail of all category                                   

$_category = Mage::getModel('catalog/category')->load($categoryId); 

echo $categoryName = $_category->getName();  

echo $categoryDescription = $_category->getDescription(); 

echo $categoryUrl = $_category->getUrl();   

echo $categoryThumbnail = $_category->getThumbnail(); 

echo $categoryLevel = $_category->getLevel();  

echo $parentCategoryId = $_category->getParentId();

它适用于类别模型。

    $Category=Mage::getModel('catalog/category')->load($cat);
    $cat_name=$Category->getName();