I am trying to extend the admin order grid by adding a single column. I don't want to add all the logic again in my code, so the only method I'm calling is _prepareColumns():

protected function _prepareColumns()
    $this->addColumn('customer_group', array(
        'header'=> Mage::helper('sales')->__('Customer Group'),
        'width' => '80px',
        'type'  => 'text',
        'index' => 'increment_id',
    return parent::_prepareColumns();

I've read this article on overriding methods, but I don't know if I'm following it correctly. My module file at ~/app/etc/modules/Namespace_Module.xml includes the following:

                <Mage_Adminhtml />
                <Mage_Core />
                <Mage_Sales />

My config.xml file contains:


On my testing site, I get only this Customer Group column on the grid. I am expecting all the columns AND this column. Am I wrong to think it will work like this?

My code is all in a custom module. Thanks.

A picture might help. I'm trying to edit this:

Mage Adminhtml Sales Order Grid

  • 1
    The depends from /app/etc/modules/Namespace_Module.xml does not influence class inheritance. In your new module, what class does your new grid block extends? Is the Mage_Adminhtml_Block_Sales_Order_Grid? Do you have rewrite rules in your module's config.xml file? Jul 4, 2013 at 15:40
  • The class is Namespace_Module_Block_Adminhtml_Sales_Order_Grid and it extends Mage_Adminhtml_Block_Widget_Grid. Yes, please see the edit for config.xml code. Thx.
    – Jongosi
    Jul 4, 2013 at 15:53
  • 3
    It should extend the Mage_Adminhtml_Block_Sales_Order_Grid, not the Mage_Adminhtml_Block_Widget_Grid. Jul 4, 2013 at 16:16

3 Answers 3


Thanks to @PandaWebStudio for pointing out my error. Yes, I am an idiot.

I was extending the original class Mage_Adminhtml_Block_Widget_Grid, which will add the single column. To get what I wanted, I needed to extend the class from Magento's sales order grid (which itself extends Mage_Adminhtml_Block_Widget_Grid):


All works perfectly now. Thanks.

  • 1
    You're welcome, and another thing I've noticed is that the new column index is increment_id, which I think is not what you want. The index should be the column name in the sql query. I think you also have to override the _prepareCollection() to get the customer group info from db. Jul 4, 2013 at 16:22

There is a better solution to add a column to the order grid, see my complete answer/solution in: Add Column to a grid (observer) - Column ‘store_id’ in where clause is ambiguous issue

  • It's bit complicated solution, instead we can achieve it simply by rewriting single file. Dec 2, 2013 at 9:35

To add customer group column in Sales Order grid. You can do it by rewriting Mage_Adminhtml_Block_Sales_Order_Grid class

  class [CompanyName]_[ModuleName]_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
    protected function _preparePage()

             ->join( array('customer'=> 'customer_entity'), 'customer.entity_id = main_table.customer_id', array('customer.group_id'));
        return parent::_preparePage();

    protected function _prepareColumns()

        $groups = Mage::getResourceModel('customer/group_collection')
            ->addFieldToFilter('customer_group_id', array('gt'=> 0))
                'header'=> Mage::helper('sales')->__('Customer Group'),
                'width' => '70px',
                'index' => 'group_id',
                'type'  => 'options',
                'options' => $groups,

        $this->addColumnsOrder('customer_group', 'shipping_name');
        return parent::_prepareColumns();

I hope above code will be useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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