Latest News : 亮瞎双眼的那些年!

Magento订单列表页面显示客户EMAIL

Magento admin 1098 views 0 comments

您所浏览查看的图片来源于鲁特仕图片存储中心img.lutish.com

有的时候后台需要查看用户的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后台订单列表显示客户支付邮箱的功能

Please indicate: 无趣的人生也产生有意思的事件 » Magento订单列表页面显示客户EMAIL

Hi, you must log in to comment !