我创建了一个自定义模块,并在管理网格中调用模块集合。按列值分组
protected function _prepareCollection()
{
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
$collection = Mage::getModel('mymodule/custom')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
我想在我的模块表中的列值,使用组..
我想这
protected function _prepareCollection()
{
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
$collection = Mage::getModel('mymodule/custom')->getCollection()->getSelect()->group('column_2');
$this->setCollection($collection);
return parent::_prepareCollection();
}
,但它不工作,它抛出一个错误
Unrecognized method 'setPageSize()'
其中我没有在我的grid.php中使用任何地方
有人可以提出我的问题,我的代码或我的问题的解决方案
试试这个.. $集合=法师:: getModel( 'mymodule中/自定义') - > getCollection(); $ collection-> getSelect() - > group('column_2'); –
非常感谢@ EmiproTechnologiesPvt.Ltd。你可以告诉我什么是问题,当我使用这个 $ collection = Mage :: getModel('mymodule/custom') - > getCollection() - > getSelect() - > group('column_2'); –