I am trying to modify the order grid in which I require the customer information like active or deactivate which is my custom customer attribute so how can I display it in grid. I have also required to display it in order view template which I have already overridden it displayed it in that file.

Note: I have modified the grid but not understanding how to display the customer `custom information. I have added the field in the grid remain is to populate it with customer data.

  • you mean to say you have one customer field/attribute called customer_activated(or Any other with "Activate/Deactivate" option values) that field/attribute you need to display in sales order grid? Commented Dec 2, 2013 at 9:24
  • Yes bijal do you have any idea?? Commented Dec 2, 2013 at 9:28

2 Answers 2



Try below class if we have customer attribute like "customer_activated"

  class [MyCompanyName]_[MyModuleName]_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
    protected function _preparePage()

         $collection  =  $this->getCollection(); 
         $customerActivated = Mage::getSingleton('customer/customer')->getResource()->getAttribute('customer_activated'); 
                    array('customerActivatedTb' => $customerActivated->getBackend()->getTable()),
                    'main_table.customer_id = customerActivatedTb.entity_id AND customerActivatedTb.attribute_id = '.$customerActivated->getId(). ' AND customerActivatedTb.entity_type_id = '.Mage::getSingleton('customer/customer')->getResource()->getTypeId(),
                    array('customer_activated' =>'customerActivatedTb.value') 
        return parent::_preparePage();

    protected function _prepareColumns()
        $options =array(
                        0 => Mage::helper('core')->__('No'),
                        1 => Mage::helper('core')->__('Yes')
                'header'=> Mage::helper('sales')->__('Customer Activated'),
                'width' => '70px',
                'index' => 'customer_activated',
                'type'  => 'options',
                'options' => $options,
                 'filter_condition_callback' => array($this, 'customerActivatedFilter'),

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

    public function customerActivatedFilter($collection, $column){
        $filterValue = $column->getFilter()->getValue();
            $filterValue = trim($filterValue);
            $filterValue = preg_replace('/[\s]+/', ' ', $filterValue);

            $where   = $collection->getConnection()->quoteInto("customerActivatedTb.value = ?", $filterValue); 


I hope above code helps you!

  • Code Works fine.... i have to modified something according to my change . Btw it works great Commented Dec 2, 2013 at 10:57

@GarthHuff you can see here Extending A Single Method Using Depends It's an example to add customer group column in sales order grid. I haven't tested it for customer activated field.

  • What if i am having my attribute in the customer_eav_attribute Commented Dec 2, 2013 at 10:08
  • please checkout my above answer, it works for me :) Commented Dec 2, 2013 at 10:41

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.