我需要在我的收藏中使用群组。我是这样做的:
$products = Mage::getModel("similar/blogpost")->getCollection()->addFieldToFilter('designid',''.$pid)->group('categoryname');
My Collection类是这样的:
<?php
class Homeliv_Similar_Model_Resource_Blogpost_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
protected function _construct()
{
$this->_init('similar/blogpost');
}
} ?>
我正在致命的错误:未定义的方法
答案 0 :(得分:0)
尝试以下..
$products = Mage::getModel("similar/blogpost")->getCollection()->addFieldToFilter('designid',$pid);
$products->getSelect()->group('categoryname');
答案 1 :(得分:0)
请在$ pid之前移除''
$products = Mage::getModel("similar/blogpost")->getCollection()
->addFieldToFilter('designid', $pid)->group('categoryname');