如何在magento 1.4中添加客户电子邮件到订单网格

时间:2011-06-20 20:09:59

标签: magento magento-1.4

我在网上找到了几种方法,但似乎都没有。有谁知道如何将客户电子邮件添加到网格中以获取Magento 1.4中的订单

2 个答案:

答案 0 :(得分:7)

复制
应用程序/代码/核心/法师/ Adminhtml /砌块/销售/订购/ Grid.php

应用程序/代码/本地/法师/ Adminhtml /砌块/销售/订购/ Grid.php

然后在以下行

$collection = Mage::getResourceModel($this->_getCollectionClass());

添加

$collection->getSelect()->joinLeft(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.customer_email'));

然后在_prepareColumns()方法中添加

    $this->addColumn('customer_email', array(
        'header' => Mage::helper('sales')->__('Customer Email'),
        'index' => 'customer_email',
        'filter_index' => 'sfo.customer_email',
    ));

请注意。你需要在所有对addColumn的调用中添加一个'filter_index',指向main_table.field_name

答案 1 :(得分:1)

我的解决方案:

$collection->getSelect()
               ->join(
               'sales_flat_order_address',
               'main_table.entity_id = sales_flat_order_address.parent_id AND      sales_flat_order_address.address_type="shipping"', array('sales_flat_order_address.email'
=> 'email'));
相关问题