您好请告诉我如何在网格中显示自定义表格数据
这是我的代码,请帮助我。
受保护的函数_prepareCollection(){
//$collection = Mage::getModel('multivendor/advertisement_advertisementproduct')->getCollection();
//print_r($collection); die("worigns");
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "Select * from adv_spaces";
$rows = $connection->fetchAll($sql); //fetchRow($sql), fetchOne($sql),...
// Zend_Debug::dump($rows);
$this->setCollection($connection);
return parent::_prepareCollection();
}
答案 0 :(得分:1)
magento方向查询
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "Select * from adv_spaces";
$rows = $connection->fetchAll($sql);
应该不起作用。对于网格集合,您需要正确的Magento Model Resource Collection
。就像
$collection = Mage::getRescourceModel('sales/order_grid_collection');