카테고리 페이지에서 카테고리 ID를 카테고리 magento로 가져 오는 방법은 무엇입니까? 미리 감사드립니다. 카테고리 페이지에서Magento의 카테고리 ID로 카테고리 이름을 얻는 방법
1
A
답변
1
는 카테고리 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();
0
,이 같은 정보를 얻을 수 있습니다 :
$category = Mage::registry('current_category');
echo $category->getName();
0
범주 모델에서 작동합니다.
$Category=Mage::getModel('catalog/category')->load($cat);
$cat_name=$Category->getName();
감사합니다. @ pankaj 선생님. –