Magento Coding Solutions

Remove Or Rename “Add New ” Button From Admin Grid In Magento Module

Example: "Jewelry" is my  Namespace and  "Basicprice" is my Module

Rename ‘Add New’ Button:

Step 1 : Go to app\code\local\Jewelry\Basicprice\Block\Adminhtml\Basicprice.php

There is a code 
public function __construct()
{

$this->_controller = "adminhtml_basicprice";
$this->_blockGroup = "basicprice";
$this->_headerText = Mage::helper("basicprice")->__("Basicprice Manager");
$this->_addButtonLabel = Mage::helper("basicprice")->__("Add New Item");
parent::__construct();


}


Step 2 : replace  $this->_addButtonLabel = Mage::helper("basicprice")->__("Add New Item");  to $this->_addButtonLabel = Mage::helper("basicprice")->__("Your Custom Name");


Here are the steps to remove the “Add New” button

Step 1 :  Go to app\code\local\Jewelry\Basicprice\Block\Adminhtml\Basicprice.php
and add  this code "$this->_removeButton('add'); " in below parent::__construct(); function

Example:
public function __construct()
{

$this->_controller = "adminhtml_basicprice";
$this->_blockGroup = "basicprice";
$this->_headerText = Mage::helper("basicprice")->__("Basicprice Manager");
$this->_addButtonLabel = Mage::helper("basicprice")->__("Add New Item");
parent::__construct();
$this->_removeButton('add');

}






No comments:

Post a Comment