How to add text field after image for the category in catalog category tried to copy app/code/core/Mage/Catalog folder to local code pool but not find out where to add a field.


you can add new custom category attribute in your Magento store via sql_setup script.

MySQL setup script will look something like this, it depends on your needs and how you would like to configure your new attribute:

    $installer = $this;

    $entityTypeId     = $installer->getEntityTypeId('catalog_category');
    $attributeSetId   = $installer->getDefaultAttributeSetId($entityTypeId);
    $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

    $installer->addAttribute('catalog_category', 'new_cat_attrb',  array(
        'type'     => 'int',
        'label'    => 'New Category Attribute',
        'input'    => 'text',
        'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'           => true,
        'required'          => false,
        'user_defined'      => false,
        'default'           => 0

        '11'                    //last Magento's attribute position in General tab is 10

    $attributeId = $installer->getAttributeId($entityTypeId, 'new_cat_attrb');

    INSERT INTO `{$installer->getTable('catalog_category_entity_int')}`
    (`entity_type_id`, `attribute_id`, `entity_id`, `value`)
        SELECT '{$entityTypeId}', '{$attributeId}', `entity_id`, '1'
            FROM `{$installer->getTable('catalog_category_entity')}`;

    //this will set data of your custom attribute for root category

    //this will set data of your custom attribute for default category


In your config.xml file of your module you will need to add this part in order to install correctly your new category attribute:


Pay attention on class tag here, class must be: Mage_Catalog_Model_Resource_Eav_Mysql4_Setup.

Reference link

You can see a new tab general tab in category form.

$installer = $this;

$installer->addAttribute("catalog_category", "testfield",  array(
    "type"     => "int",
    "backend"  => "",
    "frontend" => "",
    "label"    => "test",
    "input"    => "text",
    "class"    => "",
    "global"   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    "visible"  => true,
    "required" => false,
    "user_defined"  => false,
    "default" => "0",
    "searchable" => false,
    "filterable" => false,
    "comparable" => false,

    "visible_on_front"  => false,
    "unique"     => false,
    "note"       => ""


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.