I need to display customer-email and product-name in admin panel order grid but my code return error.


How to add products to the order grid is out of scope for an answer here but there are extensions that already to this quite well.

I can recommend this one: http://www.xtento.com/magento-extensions/enhanced-order-grid.html

I am not affiliated with the vendor, but used it for a project, it was easy to integrate and the code quality was okay.

|improve this answer|||||

Declare a Module:


Module declaration:

<?xml version="1.0"?>
                <Mage_Adminhtml />

Create module directory:


Create config file:


You will need to rewrite the Sales Order Grid block in the admin. You will also need to alter the collection to add customer emails to the collection.


<?xml version="1.0"?>

Now create the observer to alter the collection:


Do a join of the collection before it is loaded:


class Namespace_Module_Model_Observer {

   public function salesOrderGridCollectionLoadBefore(Varien_Event_Observer $observer) {

       /** @var Mage_Sales_Model_Resource_Order_Grid_Collection $collection */
       $collection = $observer->getEvent()->getOrderGridCollection();

           array('customer_table' => $collection->getTable('customer/entity')),
           'main_table.customer_id = customer_table.entity_id',

Rewrite the Grid block class to add a column:


Block Class:


class Namespace_Module_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid {

    protected function _prepareColumns() {

        $this->addColumnAfter('customer_email', array(
                'header' => Mage::helper('customer')->__('Customer Email'),
                'index' => 'email',
                'type' => 'text',
                'width' => '100px',
        ), 'created_at');

        return parent::_prepareColumns();


Now you will see the email of the customer who placed the order.

Products is a much different beast, but this gets you halfway there :)

|improve this answer|||||
  • 1
    Apparently it's not out of scope ;) – ladle3000 Feb 14 '15 at 2:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.