• Home
  • >
  • Magento
  • >
  • How To Add Attributes for Categories in Magento

How To Add Attributes for Categories in Magento


The Magento admin panel lets you add attributes only for products. If you want to add attributes to a category, here’s what you have to:

You have to write sql query in your phpmyadmin or better still, create a new custom module and add attributes to the category from the mysql setup file of the module.

In this post, we’ll show you how to add a new custom category attribute in Magento.

First, you have to create a new module to add a custom category attribute, let’s call it “Custom Category Attribute”.

Step 1. Create new module.

Initial configuration file is located in ‘app/etc/modules/Dat_CustomCategoryAttribute’. Dat_CustomCategoryAttribute

It means that the module is active and it is located in the local code pool.

Step 2. Configure module.

Module configuration file is located in “app/code/< code pool>/< name space>/< module name>/etc” and its name is config.xml – note, that in this case this looks like ‘app/code/local/Dat/CustomCategoryAttribute/etc/config.xml’. Config.xml

As you can see, the configuration file is not large at all, there are only 2 nodes: one is module version and the other is resources for install script. The install script helps us to create a new attribute. In the node we defined the class for our install script which will be used for the extension. Working with methods of this class helps us create, update, remove attribute (etc). And the node says that the script must be located in the folder with the same name (in this case path will be ‘app/code/community/Dat/CustomCategoryAttribute/sql/add_category_attribute’)

Step 3. Create attribute.

Another vital thing is creating install script file in the folder ‘add_category_attribute’. Since the file name depends on the module version, it looks like this: ‘mysql4-install-x.x.x.php’, where x.x.x is the version of the module. Mysql4-install-0.0.1.php

As a result, we created a new attribute in the category with label ‘Custom attribute ‘. This attribute is a text and it must be visible on the frontend. Check this out!

Step 4. Check result.

Here, let’s clear cache and after this, go to Admin Panel –> Catalog –> Manage Categories –> General Information tab you will see a new attribute: ‘Custom attribute’.


Moreover, to see the content from ‘Custom attribute’ on the frontend in the category page – you need to go of this page (‘app/design/frontend/< package> /< theme>/template/catalog/category/view.phtml’), check please the following code:

April 22 , 2016

Digital Aptech

This entry was posted in Magento

Why Hire Us?

  • Awarded with "Fastest growing Indian company excellence award" at 8th International Achievers Conference at Bangkok, Thailand.
  • Featured as the "Company of the Month" in December 2016 in India's premier IT magazine, Silicon India having significant circulation in US and in India.
  • Featured among the "20 most promising Digital Marketing Solution Providers in India in 2016" in the prestigious entrepreneur magazine in India
  • ISO 9001:2008 Certified & RAR+ Recommended Company
  • Around 200+ In-house Employee and 800+ Years Of Collective Experience
  • 1500+ Digital Projects Delivered
  • Savings of up to 50% on your project cost
  • Assured monthly work production of 160 hours Guaranteed
  • Total Project Management Control
  • 9000 sq. ft. State-of-the-art Facilities & Infrastructure
  • Work with Your OWN remote team
  • 24x7 Availability when required
  • We Sign NDA for Confidentiality, All Rights Are Owned By You
  • Profitable Since Inception. US$ 2Million turnover

Projects VS DRM!

This is a Detailed Breakdown of the Advantages that the Dedicated Resource Model vis-à-vis the Conservative Project Model. Read More...

Quick Contact

Keep in touch at


We are here to help you and would love to hear from you, so please feel free to contact us.

US Office

Visit Us

Brett Wharton
301 S. Capitol Blvd.
Boise, ID 83702

Tel: +1 208 921 6474

UK Office

Visit Us

Box 4343,Office 6 Slington House,
Rankine Road, BASINGSTOKE,
RG24 8PH, United Kingdom

Tel: +44 20 79932099

India Office

Visit Us

EN-34 (9th Floor),
Block-EN, Sector - V,
Salt Lake City, Kolkata - 700091, West Bengal, India

Sales: +91 9831559695
HR: +91 8276000867

Australia Office

Visit Us

25, Ashbury Grove,
Australia – 3037

Tel: +61 433 134 786