Sunny
Sunny

Reputation: 11

Magento Sales Order Grid Column remove

How can I remove column from Mage_Adminhtml_Block_Sales_Order_Grid ?

I want to remove the billing name from sales order grid.

I just commented that AddColumn part, but that column can not hide or remove

Thanks

Please Help......

Upvotes: 0

Views: 1010

Answers (2)

H.Len
H.Len

Reputation: 41

If you changes something in Magento's Core, some issues could appear if you update your Magento for example. If you want to do it anyway, be sure you don't have any module which overwrites Magento's Order Grid.

Maybe could you create a very light module, and in the Observer.php create a little function like this one:

public function removeBillingNameColumn(Varien_Event_Observer $observer) {
    $block = $observer->getEvent()->getBlock();
    $this->_block = $block;
    if (get_class($block) == Mage::getStoreConfig("yourmodulename/system/grid")) {
       $block->removeColumn('qty');
    }
}

Then in config.xml you can do something like this :

<events>
    ...
    <adminhtml_block_html_before>
        <observers>
            <yournamespace_yourmodulename_sales_order_remove_column>
                <class>Yournamespace_Yourmodulename_Model_Observer</class>
                    <method>removeQtyColumn</method>
            </yournamespace_yourmodulename_sales_order_remove_column>
        </observers>
    </adminhtml_block_html_before>
    ...
</events>

A similar thing works on my Magento.

Hope I've help you.

Upvotes: 1

Sunil
Sunil

Reputation: 26

Please comment this section in Grid.php file

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

I have attached the snapshot after commenting the section. It is working fine.
Thanks

snapshot

Upvotes: 0

Related Questions