Magento 检索某个店铺下的分类信息

Mage_Catalog_Model_Category模型类的getCategories方法可做此用
....
/**
* $parent : 查询的根分类
* $recursionLevel : 查询层级0为所有
* $sorted : true|false
* $asCollection :true将分类平面展开,false则呈树状展示。
* $toLoad : true|false;
*/
public function getCategories($parent, $recursionLevel = 0, $sorted=false, $asCollection=false, $toLoad=true) {
.........
}


两个调用实例如下:
// 取得当前店铺的根分类ID
$parent     = Mage::app()->getStore()->getRootCategoryId();
// 获得当前店铺下的所有分类
$categories = Mage::getModel('catalog/category')
->getCategories($parent, 0, false, true, true);


// 取得店铺代码为embview的根分类ID
$parent     = Mage::app()->getStore('embview')->getRootCategoryId();
// 获得当前店铺下的所有分类
$categories = Mage::getModel('catalog/category')
->getCategories($parent, 0, false, true, true);

你可能感兴趣的:(PHP)