有的时候后台需要查看用户的EMAIL方便了解具体的详情,如图所示的效果,此在MAGENTO1.9.1版本中只需要针对单个文件进行修改就可以实现 打开网站根目录下的
app\code\core\Mage\Adminhtml\Block\Sales\Order\Grid.php
修改58行左右的内容
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$this->setCollection($collection);
return parent::_prepareCollection();
}
为
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('customer_email'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
然后在此文件的大约
$this->addColumn('shipping_name', array(
'header' => Mage::helper('sales')->__('Ship to Name'),
'index' => 'shipping_name',
));
后面添加
$this->addColumn('customer_email', array(
'header' => Mage::helper('sales')->__('Payment method'),
'index' => 'customer_email',
'filter_index' => 'sales_flat_order.customer_email',
));
至此完成magento后台订单列表显示客户支付邮箱的功能 (责任编辑:好模板) |