1

我已经在 magento 的类别中添加了自定义属性,现在我需要在自定义模块中使用这些属性过滤器选择类别。有人可以帮助我吗?任何帮助将不胜感激。

谢谢,伊尔凡

4

2 回答 2

3
$categories = Mage::getModel('catalog/category')
    ->getCollection()
    ->addAttributeToFilter('attribute_code_here', 'value_here');
$categories->addAttributeToFilter('parent_id', 2);//if you want only children of a specific category
    foreach ($categories as $category){
        //do something with $category
    }
于 2013-07-25T11:05:05.990 回答
1

没关系,我得到了解决方案。我只需要添加下面的代码行就可以了

->addAttributeToFilter('door_material', 53)

其中“door_material”是类别的自定义属性, “53”是在后端选择的选项 id。我希望它会对某人有所帮助。

于 2013-07-26T12:34:39.857 回答