我正在尝试column
在位于此处的销售订单网格中添加新的客户名称:
App/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php
我想在管理客户中添加客户名称,如名称。
我添加了以下代码:
protected function _getCollectionClass()
{
return 'sales/order_grid_collection';
}
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
/*junpeng add start*/
$collection->getSelect()
->join(
'customer_entity',
'main_table.customer_id = customer_entity.entity_id', array('email' => 'email'));
$collection->getSelect()->join(
'customer_entity_varchar',
'main_table.entity_id = customer_entity_varchar.entity_id', array('name' => 'value')
);
/*junpeng add end*/
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('name', array(
'header' => Mage::helper('sales')->__('Customer Name'),
'index' => 'name',
));
$this->addColumn('email', array(
'header' => Mage::helper('Sales')->__('Customer Email'),
'index' => 'email',
'type' => 'text',
));
}
客户邮箱是可以的,但是添加客户名称不起作用!
有人可以帮我解决这个问题吗?