首页 > 其他分享 >Magento: 通过id获取类别名字等信息 get category by id

Magento: 通过id获取类别名字等信息 get category by id

时间:2023-03-23 12:06:33浏览次数:40  
标签:category load useful parentCategoryId url get Magento id



<?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.

 

标签:category,load,useful,parentCategoryId,url,get,Magento,id
From: https://blog.51cto.com/u_8895844/6144596

相关文章