I have found where the buttons (reset, delete and save) get added in app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml:

Line 28:

<div class="content-header">
        <h3 class="icon-head head-categories"><?php echo $this->htmlEscape($this->getHeader()) . ($this->getCategoryId() ? ' (' . Mage::helper('catalog')->__('ID: %s', $this->getCategoryId()) . ')' : '') ?></h3>
        <p class="content-buttons form-buttons">
            <?php echo $this->getResetButtonHtml() ?>
            <?php if($this->getCategoryId()): ?>
                    <?php echo $this->getDeleteButtonHtml() ?>
            <?php endif; ?>
            <?php echo $this->getAdditionalButtonsHtml(); ?>
            <?php echo $this->getSaveButtonHtml() ?>

And in app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php are the methods and logic to add them.

I would like to add my own but I really don't want to be copying form.phtml into my local directory nor would I really want to overwrite Form.php. Is there a better way? Possibly with my layout xml for my module?

Thanks in advance.

1 Answer 1


Here is how I usually do it.

  • I create a new module with a block inside it.
  • That block contains a method that adds a button and it should be placed as a child for category.edit block.

You will need the following files:

app/etc/modules/[Namespace]_[Module].xml - the declaration file

<?xml version="1.0"?>
                <Mage_Adminhtml />

app/code/local/[Namespace]/[Module]/etc/config.xml - the configuration file

<?xml version="1.0"?>

app/design/adminhtml/default/default/layout/[namespace]_[module].xml - the admin layout file

<?xml version="1.0"?>
        <reference name="category.edit">
            <block name="[module].buttons" type="[module]/adminhtml_catalog_category_edit_buttons">
                <action method="addButtons"></action>

app/code/local/[Namespace]/[Module]/Block/Adminhtml/Catalog/Category/Edit/Buttons.php - the block with the buttons.

class [Namespace]_[Module]_Block_Adminhtml_Catalog_Category_Edit_Buttons 
    extends Mage_Adminhtml_Block_Catalog_Category_Abstract {
    public function addButtons()
                    ->addAdditionalButton('some_button_code_here', array(
                        'label' => $this->helper('[module]')->__('Button label here'),
                        'class' => 'add',
                        'onclick' => 'alert(\'It works\')' //change the action of the button to what you need
        return $this;

app/code/local/[Namespace]/[Module]/Helper/Data.php - the module helper

class [Namespace]_[Module]_Helper_Data extends Mage_Core_Helper_Abstract{

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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