I want add a new button in customer edit page.

Here: Add button

Between Reset and Create Order.

I try override "Mage_Adminhtml_Block_Customer_Edit" but when go to the customer edit page return this error:


This is my config.xml:

    <?xml version="1.0"?>
                <!-- no dependencies -->
        <models />
        <resources />
        <extraconfig />

In the Block override only modify function construct:

class Company_Unblock_Block_Adminhtml_Customer_Edit extends Mage_Adminhtml_Block_Customer_Edit
    public function __construct()
        $this->_objectId = 'id';
        $this->_controller = 'customer';

        if ($this->getCustomerId() && 
            Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/create')) {
            $this->_addButton('order', array(
                'label' => Mage::helper('customer')->__('Create Order'),
                'onclick' => 'setLocation(\'' . $this->getCreateOrderUrl() . '\')',
                'class' => 'add',
            ), 0);



        $this->_updateButton('save', 'label', Mage::helper('customer')->__('Save Customer'));
        $this->_updateButton('delete', 'label', Mage::helper('customer')->__('Delete Customer'));

        if (Mage::registry('current_customer')->isReadonly()) {

        if (!Mage::registry('current_customer')->isDeleteable()) {

Can you help me?


Can I add a custom button without override? – str_lml

You can add buttons via event/observer ...



public function addButton(Varien_Event_Observer $observer)
    if ($observer->getBlock()->getType() != 'adminhtml/customer_edit') {

    $data = array(
        'label'     => '...',
        'onclick'   => '...',
    $observer->getBlock()->addButton('your_button', $data);

For the correct position, see Mage_Adminhtml_Block_Widget_Container::addButton()

public function addButton($id, $data, $level = 0, $sortOrder = 0, $area = 'header')

In your config.xml below code is there if its not used then remove it


or create a helper classs

in app/code/[codePool]/Company/Unblock/Helper and put below code in Data.php


class Company_Unblock_Helper_Data extends Mage_Core_Helper_Abstract

  • The helper class will be needed anyway for module's translations Jun 29 '18 at 11:22
  • @simonthesorcerer , that's depends on his requirement , if he wants to translate text then yes its needed Jun 29 '18 at 11:23
  • I remove the Helper code in config.xml and in my construct i have $this->_addBUtton(".....") but don't show the new button is like don't override the function.
    – str_lml
    Jun 29 '18 at 11:31
  • Can I add a custom button without override?
    – str_lml
    Jun 29 '18 at 11:39
  • @str_lml is order is your button ??? Jun 29 '18 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.