Magento: How to remove or rename ‘Add New’ button from Admin Grid?

Case:

Here, I am taking the scenario of a custom Magento module. You are developing a custom Magento module and you don’t want to show the ‘Add New’ button in the Grid. The Add New button is present in top right corner of Grid Page.

Rename ‘Add New’ button

Here are the steps to rename the ‘Add New’ text to anything you required (for example, ‘Add Report’):-

– Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.php
– Add the following code in the constructor of this file:-


	$this->_addButtonLabel = Mage::helper('yourmodulename')->__('Add Report');

– You are done.

Remove ‘Add New’ button

Here are the steps to remove the ‘Add New’ button:-

– Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.php
– Add the following code in the constructor of this file (it should be just below the call to parent constructor):-


	parent::__construct(); 
	$this->_removeButton('add');

– You are done.

Hope this helps. Thanks.