如何在magento客户网格中自定义数据库值
为了特殊目的,我为客户模块创建了新的magento网格 其中有一列如何在magento客户网格中自定义数据库值,magento,magento-1.7,Magento,Magento 1.7,为了特殊目的,我为客户模块创建了新的magento网格 其中有一列usertype,它的值为0,1,2 它将在客户网格页面中显示为0,1,2 但我需要显示值是否为 0 -> Inactive 1 -> Activated 2 -> Baned 我怎样才能做到这一点 这是我在_prepareColumns()中的代码grid.php: 如果这在magento中是可能的。如果您的贪婪实现了Mage\u Adminhtml\u Block\u Widget\u Grid我建议
usertype
,它的值为0,1,2
它将在客户网格页面中显示为0,1,2
但我需要显示值是否为
0 -> Inactive
1 -> Activated
2 -> Baned
我怎样才能做到这一点
这是我在_prepareColumns()中的代码grid.php:
如果这在magento中是可能的。如果您的贪婪实现了
Mage\u Adminhtml\u Block\u Widget\u 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')
现在,您已经使用值创建了下拉列表。
然后更新\u prepareCollection()
函数并将属性值添加到客户网格集合中
$collection->joinAttribute('usertype','customer/usertype','entity_id',null',left')代码>我从
使用rendere将有助于将vlaues加载到每一行。有人对此有任何解决方案吗?这将为您指明正确的方向,但这确实是一个答案。你至少应该在这里综合重要的步骤。
array( 'value_id' => 'value_label')