Rewrite adminhtml form magento

This tutorial explain how to rewrite adminhtml form magento. The tutorial show how to extend magento extension admin form and add new form fields as shown below.

Also refer the tutorial explains how to tables upgrade script and create magento admin grids.

rewrite adminhtml form magento

File Structure

rewrite adminhtml form magento file structure

Config file

Declare the new class in config file

override adminhtml form magento

Rewrite admin form

Extend the parent class and add the additional fields in form


require_once 'Vsourz/Imagegallery/Block/Adminhtml/Image/Edit/Tabs/Form.php';

class Addpeople_Imagegalleryext_Block_Adminhtml_Image_Edit_Tabs_Form 
        extends Vsourz_Imagegallery_Block_Adminhtml_Image_Edit_Tabs_Form {
    protected function _prepareForm() {
        if (Mage::registry('image_data')) {
            $data = Mage::registry('image_data')->getData();
        } else {
            $data = array();
        $form = $this->getForm();
        $fieldset = $form->addFieldset('imagegalleryext_image', array('legend' => Mage::helper('imagegalleryext')->__('Additional Fields')));  
        $fieldset->addField('filters_workshop_colour', 'select', array(
            'label'     => Mage::helper('imagegalleryext')->__('Filters Workshop Colour'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'filters_workshop_colour',
            'value'  => '0',
            'values' => array('0' => 'Yes','1' => 'No'),
            'disabled' => false,
            'readonly' => false,          
        return $this;

Share this Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *