Magento – Adding Custom Category Fields Attributes

You know in Magento backend, you can add new product attribute easily which allow you to extend and add more product information. So here I will show you how to add new category attribute – same way Magento did with product attribute.

Before going into detail, you should be noticed that Magento use EAV database which build based entity (product, category, customer,….) so in order to add a new “field” you will need to add a record EAV for the entity you are working with.

To add attributes to category, you need to write sql query in your phpmyadmin or a better way would be creating a new custom module and adding attributes to category from the mysql setup file of the module.

Looking for improvement for your Magento Store?
Facebook Connector Extension
Product related article extension
Magento Offer popup on exit extension
Unlimited Slideshow Magento Extension
Light Checkout in One Step Magento Extension

By mysql setup file, I mean the file inside the directoryYourNamespace/YourModule/sql/yourmodule_setup/

Create a new module and write the following in your module’s mysql setup file.

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_category', 'my_attribute', array(
'group' => 'General',
'input' => 'text',
'type' => 'varchar',
'label' => 'My Attribute',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,

The above code will create a category with the code ‘my_attribute‘ and lable ‘My Attribute‘. You can view it under Admin Panel –> Catalog –> Manage Categories –> General Information

Hope this helps. Thanks.