How to add dropdown attribute for category in magento

12 / Mar / 2013 by amatya 3 comments

Adding attributes from admin is simple in magento. But this feature is only for products. Some times there is requirement to add custom attribute for category to customize magento. Following is the code to add dropdown attribute for category.


$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);

$setup->addAttribute(‘catalog_category’, ‘category_color’, array(
‘group’ => ‘General’,
‘input’ => ‘select’,
‘type’ => ‘varchar’,
‘label’ => ‘Border Color’,
‘option’ => array (
‘value’ => array(‘optionone’=>array(0=>’red’),’optiontwo’=>array(0=>’green’),

‘backend’ => ‘eav/entity_attribute_backend_array’,
‘visible’ => 1,
‘required’ => 0,
‘user_defined’ => 1,
‘global’ => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,

If you want to add new tab in category page in admin then what you need to do is just replace following line.

‘group’ => ‘General’


‘group’ => ‘Your Custom Tab’

Hope this will help you 🙂

Amatya Trivedi


comments (3)

  1. Nicolás

    Great tutorial, it works fine, but I have a problem.
    The values beeing saved are not, ‘optionone’, ‘optiontwo’, etc, the select in the admin panel creates some custom values so I don’t know how to access those values then.


Leave a Reply to Nicolás Cancel reply

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