2013-02-23 61 views
2

我为客户模块创建了新的特殊用途magento网格。如何自定义magento客户网格中的数据库值

在存在有一列usertype它具有值0,1,2。

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

,但我需要显示,如果值是,

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

哪能dothis?

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

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

如果这是可能在Magento。

+0

任何人有任何解决方案吗? – Kichu 2013-02-23 07:05:59

回答

0

我从this

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

+0

这指出你在正确的方向,但它确实是一个答案。你至少应该综合这里的重要步骤。 – 2014-10-02 11:16:50

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');

相关问题