【发布时间】:2015-01-02 19:11:48
【问题描述】:
我开发了自定义管理模块。我使用了常用的方法 _prepareCollection 和 _prepareColumns 在 Grid 中显示数据。
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,则我想将值显示为“已批准”,如果标志为 2,则“待定”等。我应该如何自定义收集数据并根据我的要求在网格中显示?帮助表示赞赏。
谢谢。
【问题讨论】:
标签: magento