我創建了一個自定義模塊,並在管理網格中調用模塊集合。按列值分組
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'); –