我有一个我写的 Magento 助手类,它在 1.3 中运行良好。但是,我们正在开发 1.4 的新安装,并且由于某种原因无法按类别过滤。
函数 __construct()
{
法师::app();
$this->model = Mage::getModel('catalog/product');
$this->collection = $this->model->getCollection();
$this->collection->addAttributeToFilter('status', 1);//启用
$this->collection->addAttributeToSelect('*');
}
函数 filterByCategoryID($catID)
{
$this->collection->addCategoryFilter(Mage::getModel('catalog/category')->load($catID));
}
我无法弄清楚为什么这在 1.4 中不起作用。有没有其他人遇到过这个问题?