2015-01-02 136 views
0

我开发了自定义管理模块。我使用了常用的方法_ prepareCollection和_ prepareColumns来显示网格中的数据。magento根据管理网格中的条件显示内容

protected function _prepareCollection() 
    { 
     $collection = Mage::getModel("wallets/sellerrequest")->getCollection(); 
     $collection->getSelect() 
     ->join(array('ce1' => 'customer_entity_varchar'), 'ce1.entity_id=main_table.seller_id and ce1.attribute_id = "5"', array('seller_name' => 'value')); 

     $this->setCollection($collection); 
     parent::_prepareCollection(); 
     return $this; 
    } 

    protected function _prepareColumns() 
    { 
     $helper = Mage::helper('sellers'); 

     $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE); 

     $this->addColumn('id', array(
      'header' => $helper->__('Request No'), 
      'index' => 'id' 
     )); 


     $this->addColumn('Requested Amount', array(
      'header' => $helper->__('Requested Amount'), 
      'index' => 'request_amount' 
     )); 

     $this->addColumn('Seller Name', array(
      'header'  => $helper->__('Seller Name'), 
      'index'  => 'seller_name', 
     )); 

     $this->addColumn('Status', array(
      'header'  => $helper->__('Status'), 
      'index'   => 'status_flag'    
     )); 

所有的数据根据​​表值正确显示。但我想要显示以$符号开头的请求金额列值, 300美元等。另外,我想根据条件显示状态标志。意思是如果状态标志是1,那么我想显示值为“Approved”,如果标志是2,那么“Pending”等等。我应该如何定制收集数据并根据我的要求在网格中显示?帮助赞赏。

谢谢。

回答