Home » Magento4 April 2011

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:-

– 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):-

– You are done.

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • SAM

    ok this is how u rename/remove the button
    what if I want to add another button say GO to User & how I manage the button Href target
    I Mean when I’ll click on Go to User the place I’ll go??

  • Anonymous

    It’s not tested but you might try:
    $this->_addButton(‘somebuttonid’, array(
    ‘label’ => Mage::helper(‘yourmodule’)->__(‘Button label’),
    ‘onclick’ => ‘deleteConfirm(“Are you sure?”, “‘.$this->getUrl(‘yourmodule/adminhtml_index/action’ , array(“id”=>Mage::app()->getRequest()->getParam(“id”))). ”)’,
    ‘class’ => ”
    ));

  • Great……..I got it.
    I was looking for this kind of stuff.
    Thanks a lot for sharing.Now i can solve my problem.

  • Robin

    Thanks a lot………

  • Manjit

    thanks… saved my day

  • Vishalsanwar

    ok
    but i want to remove RESET FILTER button .
    How is it possible ???

  • armand

    parent::__construct();

    $this->_removeButton(‘reset’);

  • dgianco

    It’s in _prepareLayout()

    protected function _prepareLayout() {
    $this->_removeButton(‘add’);
    return parent::_prepareLayout();
    }

    in _construct() NOT WORKING

  • PHP Developer

    I am getting error as “Invalid method removeButton”