0
我想创建一个可显示2个(或更多)类别产品的块。我试图用几种方法做到这一点,但它们不起作用。Magento 1.7显示块中的2个类别中的产品
我怎样努力:
/app/code/local/Mage/Catalog/Block/Product/Fulllist.php (同list.php的具有改变_getProductCollection()函数:)
protected function _getProductCollection()
{
$_productCollection = Mage::getModel('catalog/product')
->getCollection()
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')
->addAttributeToSelect('*')
->addAttributeToFilter('category_id', array(
array('finset' => '30'),
array('finset' => '32'))
)
->addAttributeToSort('created_at', 'desc');
return $_productCollection;
}
然后,在CMS页面中的一个我试图用:
{{block type="catalog/product_fulllist" template="catalog/product/list.phtml"}}
但是,这似乎并没有工作,页面是明确的。我错过任何部分?还是有更简单的方法来做到这一点?
问候!
不幸的是没有,当我打印出来的查询,它看起来像:[链接](http://pastebin.com/tZQGL44X)我注意到的是有没有WHERE子句在那种查询中常见?有些东西显然不适用。先生,谢谢您的帮助! – jwitos