<?php
// get category model by category id, assume you have known category id, $categoryId
$_category = Mage::getModel('catalog/category')->load($categoryId);
// category name
$categoryName = $_category->getName();
// category description
$categoryDescription = $_category->getDescription();
// category url
$categoryUrl = $_category->getUrl();
// category url key
$categoryUrlKey = $_category->getUrlKey();
// category thumbnail
$categoryThumbnail = $_category->getThumbnail();
// category image url
$categoryImageUrl = $_category->getImageUrl();
// category level
$categoryLevel = $_category->getLevel();
// parent category
$parentCategoryId = $_category->getParentId();
$parentCategory = Mage::getModel('catalog/category')->load($parentCategoryId);
Enjoy Magento! Hope that’s useful for you.
原文/转自: Magento: 通过id获取类别名字等信息 get category by id
本文展示了如何使用Magento框架通过类别ID获取类别名称、描述、URL等关键信息,提供了一个实用的代码示例。
3404

被折叠的 条评论
为什么被折叠?



