如何在magento网格中显示选择名称而不是值

时间:2014-10-07 13:48:56

标签: php magento

我想在magento网格中显示市场下拉名称,但我在代码中写下了显示市场价值的内容。我的代码是

 protected function _prepareColumns()
    {
    $this->addColumn('marketplace', array(
    'header'    => Mage::helper('adminhtml')->__('Marketplace'),
    'align'     =>'right',
    'width'     => '10px',
    'index'     => 'marketplace',
    ));
    $this->addColumn('action',
    array(
    'header'    => Mage::helper('adminhtml')->__('Action'),
    'width'     => '100px',
    'type'      => 'action',
    'getter'    => 'getId',
    'actions'   => array(array(
    'caption' => Mage::helper('adminhtml')->__('Edit'),
    'url'     => array('base' => '*/*/edit'),
    'field'   => 'id'
    )),
    'filter'    => false,
    'sortable'  => false,
    'index'     => 'id',
    ));
    return parent::_prepareColumns();
    }

任何人都可以指出我做错了什么,因为我没有太多的magento经验。

提前感谢你们

1 个答案:

答案 0 :(得分:1)

为市场添加字段类型,如...

$this->addColumn('marketplace', array(
'header'    => Mage::helper('adminhtml')->__('Marketplace'),
'align'     =>'right',
'width'     => '10px',
'index'     => 'marketplace'
'type'    => 'options',
'options'   => array(
                6 => '6',
                5 => '4',
                4 => '4',
                3 => '3',
                2 => '2',
                1 => '1'
            ),
));