Custom attributes for categories in Magento

Sometimes there is a requirement to have custom attributes for a category, but it isn't that straightforward to add, at least not through the GUI. The method, for a text input, is:
  • 1

    Create the new attribute via admin, or via SQL using the following:
    INSERT INTO `eav_attribute` (`entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_input_renderer`, `frontend_label`, `frontend_class`, `source_model`, `is_global`, `is_visible`, `is_required`, `is_user_defined`, `default_value`, `is_searchable`, `is_filterable`, `is_comparable`, `is_visible_on_front`, `is_html_allowed_on_front`, `is_unique`, `is_visible_in_advanced_search`, `is_configurable`, `apply_to`, `position`, `note`, `is_used_for_price_rules`, `is_filterable_in_search`, `used_in_product_listing`, `used_for_sort_by`) VALUES
    (9, 'ATTRIBUTE_CODE', NULL, '', 'varchar', '', '', 'text', NULL, 'ATTRIBUTE_NAME, NULL, '', 0, 1, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 1, '', 1, ', 1, 0, 0, 0);
    Replace ATTRIBUTE_* with your variables.
  • 2

    Create the relationship, using the following: Replace 944 with the ID from the attribute above and 5329 with the next incremented ID in eav_entity_attribute
    INSERT INTO `eav_entity_attribute` (`entity_attribute_id`, `entity_type_id`, `attribute_set_id`, `attribute_group_id`, `attribute_id`, `sort_order`) VALUES
    (5329, 9, 12, 7, 944, 2); 
  • Chris


    I tried the above but could not get it to work - I get an error on column count ?

    I am running version 1.4 and need to specify 4 new inputs and one text area under the General tab for categories. If you can help it would be great!



    Hi Chris,

    This isn't tested on 1.4 - so I cannot comment. I can give it a try at some point next week for you.

    • Ronald

      Hi there,

      You need to add the same id in the catalog_eav_attribute table as well...
      Tested is 1.4.

      Hope this will help someone

  • Shaun E

    Thanks for posting this solution guys. This approach works OK but I think I would like to recommend another approach that involves creating a mini module. It seems more upgradeable. Here is the link.

    It is in french, which I don't know, but if you have a little experience with Magento you can probably figure out the steps.

  • Daniela


    I tried these steps, but it won't show me the two new attributes within a Categorie under Manage Categories. What else do I need to to to get these attributes shown there to insert some more information?

    Hope, someone has an idea for me?

    Thanks, Dani

  • Piers


    I seem to be having the same problem as Dani. Is there a missing step to make it appear?


    • Piers

      Ah, You also have to register your attribute in table “catalog_eav_attribute”.

      Just insert a new entry with the attribute_id to match your new attribute.


      • Benjamin


  • Narendra

    I inserted the data in all three tables i.e. eav_attribute, eav_entity_attribute and catalog_eav_attribute but I still could not see new attribute in backend. Why isn't it visible in add new category form?

    • Benjamin

      Are you sure you inserted the appropriate attribute type ID?

      Its worth looking at some of the other standard category attributes - then comparing the default values to ensure yours are the same.

  • Sunil Rana

    Quick and easy steps every seen on how to add custom attributes.