2015-02-24 32 views
1

我必須在超級管理員的網格中顯示自定義表格數據,我不知道它會如何。 這裏是我的網格文件代碼。在magento中獲取自定義表格數據

public function __construct(){ 
     parent::__construct(); 
     $this->setId('customerGrid'); 
     $this->setUseAjax(true); 
     $this->setDefaultSort('entity_id'); 
     $this->setSaveParametersInSession(true); 
    } 
    protected function _prepareCollection(){ 
     $collection = Mage::getResourceModel('Advertisement/Advertisementproduct')->getCollection(); 
     //print_r($collection);die; 
     $this->setCollection($collection); 
     return parent::_prepareCollection(); 


    } 
+0

是$集合給出的結果? – 2015-02-24 12:46:34

+0

它看起來okey。可能你需要試試這個博客 http://excellencemagentoblog.com/blog/2011/09/26/admin-part1-series-magento-admin-forms-grids-controllers-tabs/ – MageDev 2015-02-24 12:48:34

+0

你好@Amit Bera no沒有顯示任何東西 – user1990386 2015-02-24 12:51:09

回答

-3
$connection = Mage::getSingleton('core/resource')->getConnection('core_read'); 
$sql = "Select * from the-table-name"; 
$rows  = $connection->fetchAll($sql); 

可以遍歷$行和打印數據。 :)

相關問題