获取自定义类别的模型

时间:2015-01-12 14:14:14

标签: magento

我们已在类别树中添加了一些属性

enter image description here

可以让foreach Mage::getModel(custom categories)获得自定义类别的所有价值吗?

1 个答案:

答案 0 :(得分:1)

您应该能够访问这些属性,但您需要先加载该类别。现在只是获取自定义属性可能会有点困难。

$cateogry = Mage::getModel('catalog/category')->load('category here');
//this could get you all attributes
$attributes = $category->getAttributes();
//this would get you just the two attributes that look custom above
$customAttributes = array(
'latitude' => $category->getLatitude(),
'longitude' =>$category->getLongitude(),
); 

我希望这有帮助!