【发布时间】:2013-04-28 01:38:06
【问题描述】:
我正在尝试在此处的销售订单网格中为客户名称添加新的 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',
));
}
客户邮箱可以,但是添加客户名不行!
有人可以帮我解决这个问题吗?
【问题讨论】:
标签: magento magento-1.7