I want to show only first name in bill to and ship to magento order grid.


     * Init virtual grid records for entity
     * @return Mage_Sales_Model_Resource_Order
    protected function _initVirtualGridColumns()
        $adapter       = $this->getReadConnection();
        $ifnullFirst   = $adapter->getIfNullSql('{{table}}.firstname', $adapter->quote(''));
        $ifnullMiddle  = $adapter->getIfNullSql('{{table}}.middlename', $adapter->quote(''));
        $ifnullLast    = $adapter->getIfNullSql('{{table}}.lastname', $adapter->quote(''));
        $concatAddress = $adapter->getConcatSql(array(
            $adapter->quote(' '),
            $adapter->quote(' '),
                array('billing_address_id' => 'entity_id'),
                 array('shipping_address_id' => 'entity_id'),

        return $this;

I tried with this function but no change.

1 Answer 1


You need to move Order Grid core file to local folder first

app\code\core\Mage\Adminhtml\Block\Sales\Order\Grid.php to app\code\local\Mage\Adminhtml\Block\Sales\Order\Grid.php

change _prepareCollection function as below

protected function _prepareCollection()
         $collection = Mage::getResourceModel($this->_getCollectionClass());
        $resource = Mage::getSingleton('core/resource');
            array('billing' => $resource->getTableName('sales/order_address')),
            'main_table.entity_id = billing.parent_id',
            array('billing_firstname' => 'firstname')
        )->where("billing.address_type =  'billing'");

        return parent::_prepareCollection();

replace below column code

$this->addColumn('billing_name', array(
       'header' => Mage::helper('sales')->__('Bill to Name'),
       'index' => 'billing_name',

replace with below

$this->addColumn('billing_firstname', array(
    'header' => Mage::helper('sales')->__('Bill to Name'),
    'index' => 'billing_firstname',

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.