2

我为特殊用途的客户模块创建了新的 magento 网格。

因为有一列usertype它的值为0,1,2。

它将在客户网格页面中显示为 0,1,2。

但我需要显示值是否为,

 0 -> Inactive
 1 -> Activated
 2 -> Baned

我怎样才能做到这一点?

这是我在 _prepareColumns() 中的代码 grid.php:

$this->addColumn('usertype', array(
            'header'    => Mage::helper('customer')->__('Usertype'),
            'width'     => '150',
            'index'     => 'usertype'
        ));

如果这在magento中是可能的。

4

2 回答 2

1

如果你的贪婪实现Mage_Adminhtml_Block_Widget_Grid我建议你修改你addColumn打电话给

$this->addColumn('usertype',
        array(
            'header'=> Mage::helper('customer')->__('Usertype'),
            'width' => '150px',
            'index' => 'usertype',
            'type'  => 'options',
            'options' => $values
        ));

哪里$values应该格式化为

array( 'value_id' => 'value_label')

现在您已经使用值创建了下拉列表。然后更新_prepareCollection()函数并将属性值添加到客户网格集合 $collection->joinAttribute('usertype', 'customer/usertype', 'entity_id', null, 'left');

于 2013-02-23T07:50:13.730 回答
0

我从中得到了解决方案

通过使用 rendere 将有助于将 vlaues 加载到每一行。

于 2013-02-23T09:01:30.883 回答