Magento Attributes Tutorial – How to Create an Attribute and Filter Through Products

Share On Facebook
Share On Twitter
Share On Linkedin

One of the best features of Magento is the ability to customize the shopping experience for your customers through the use of attributes. Offering more options (attributes) for visitors to narrow down their search increases the chance of making the sale. This tutorial will go over what Magento attributes are, how to create them, and how to add an attribute to the ‘sort by’ filter that is located in your category pages.

For instance, a category page showing computers and you are able to filter these computers through ‘name’, ‘price’ and ‘position’ attributes. In Magento, an ‘attribute’ is a set of data such as ‘price’ or ‘product name’ that helps describe a product. Attributes can be used in a few different ways in Magento. One is to be displayed on the product view page or the category list page (Such as the price and product name). Another method is filtering. In this tutorial you will learn how to assign another attribute to the ‘sort by’ filter. We will use an existing attribute in our demo store titled ‘ram_size’ so we can filter computers by the amount of ram they come packaged with. In the end the ‘sort by’ menu will look like this:

Before we start, we should make sure you are familiar with a few things. In the world of Magento attributes we will find ourselves working with what are known as ‘attribute sets’.

What Is An Attribute Set?

Think of an ‘attribute set’ as a ‘product type’. If you sell cameras, computers and other electronics, you will find yourself editing these unique product types over time. You will notice that, as time goes on, the camera products need attributes such as megapixel and the computer products needs ram_size so attribute sets are methods that allow you to edit a product where you can define which attributes appear for which product type so you have full control over the data you enter for each unique product type.


Need help setting up “Magento Attributes” on your Magento website? Contact us today to talk about how we can help you. We have a variety of solutions to fit MOST budgets! Fill out our contact form by clicking here and you will receive a response, typically within hours!

So you will have a ‘megapixel’ attribute that will load on the camera product page but will not appear on the ‘computer’ product page. Therefore, having an attribute ‘megapixel’ assigned to the ‘camera’ attribute set makes sense because when you edit the product page in the ‘camera’ attribute set, you can find the ‘megapixel’ field and add the value and when you edit a computer product you will not see a ‘megapixel’ attribute field. This is the purpose of having unique attribute sets. With that said, let’s learn how to add an attribute to a unique attribute set while also making sure it is part of the ‘filtering’ process in the ‘sorty by’ field as shown above. It all starts with the most important step:

Create or Edit The Attribute

To check and see if an attribute exists, navigate to the top menu and place your mouse over ‘catalog’ and then scroll to the ‘attributes –> manage attributes’ link. See below for reference:

At this point you will see a page listing all of your attributes. Please make sure that you have selected to view all of your attributes (assuming you have less than 100) by choosing ‘100’ in the ‘view per page’ pull-down field:

Now, for the sake of demonstration let us say that we are selling electronics (primarily computers) and we wanted to have customers filter by the amount of ram size that is equipped with each computer. Well, in this example, the attribute does exist but let’s take a look at how it works so you can learn not only how to create your own attribute but also work with any existing attribute. Let’s now move onto the second step in ensuring your attribute will be used for proper filtering…

The Attribute Must Be Available For Filtering

When you click on the attribute of choice (in our example it will be ‘ram_size’) you will see an ‘edit attribute page’. There are a few steps you must pay close attention to when setting this up for your store. First, pay special attention to the attribute properties:

When you create your own attribute you will always want to remember that you use lowercase letters, and an underscore in place of spaces, for the “Attribute Code”. So if you were to create an attribute called “Computer Color” you would create it as ‘computer_color’ in the ‘attribute code’ field.

The next field to pay attention to when you create an attribute (or edit one as in this case) is the ‘Scope’. There are 3 types of ‘scopes’ in Magento (Global, Website and Store). This is based on the different types of ‘views’ offered in Magento. To learn more, you should read the summary provided by the developers of Magento.

At this point it is important to pay close attention to the second part of this page which is listed below and titled “Frontend Properties”.

“Frontend Properties” is another way of saying “Determine how you display it on the product view page and the category page. You have to determine if you want it to be available in the ‘sorting’ pull down which appears on category pages (Look for the ‘sort by’ pull-down menu on the top right of this image)

You will see how it is, in this example, using the ‘name’ attribute to filter through the category page. Well, we want ‘ram_size’ to be a part of that filter so we look for the “” label in the ‘Frontend Properties” section and choose ‘yes’.


Need help setting up “Magento Attributes” on your Magento website? Contact us today to talk about how we can help you. We have a variety of solutions to fit MOST budgets! Fill out our contact form by clicking here and you will receive a response, typically within hours!

When you look at the other fields from which you can choose from, you notice they refer to being visible on the product view page and in the product listing. The product listing is the category page. Choose ‘yes’ if you want to use that information in the template (please note you may have to edit your template files to display this data if it is not loading already and that will be explained in another tutorial). For now, let’s focus on getting this to show up in the ‘sort by’ product filter in the category page.

Choose ‘yes’ for ‘‘ and then click on the top left tab titled “Manage Labels/Options”.

When you do that you will see a section that lets you edit the ‘label’ of the attribute. What this means is, when you are editing your product you will see a section in your ‘edit product’ area that shows you the name of the attribute such as when you see the ‘Product Name/Price/Weight” fields when editing a product. Those are the ‘labels’ of the ‘name’, ‘price’ and ‘weight’ attributes. So in our example we see “Ram Size” as the label. At this time, we want to be able to *see* our attribute show up in our ‘edit product’ section so we must make that…

If you need help with your Magento store, call 845-656-3000 or Contact us here »

The Attribute Exists In The Proper “Attribute Set”

When we say ‘attribute set’ we refer to the type of product you are selling. For instance, in this example, we are using a demo website that sells furniture, computers and electronics. In order to get ‘ram_size’ to load up for my computers, I must first make sure to have a ‘computer’ attribute set.

(NOTE: While we are reviewing an ‘edited/existing’ attribute, when you create one, you will be asked to re-index your database. I will detail how to do that near the end of this tutorial).

To understand how attribute sets work, and how to add the ‘ram_size’ attribute to it, let’s go back to the product catalog section in the admin. Choose ‘Catalog –> Manage Products’ in the top navigation and you will see something like this:

How did our store receive so many attribute sets? Let’s go to the ‘attribute set’ page and you will see that they were created. First, navigate to the ‘attribute set’ page.

When you get there you should see something like this (although your store will most likely not have nearly as many attribute sets created):

When you are on that page, on the top right, is a ‘Add New Set’ button. You can create a new one if your attribute ‘Computers’ did not exist. It would ask you ‘based on’ such as ‘base this attribute set on an existing one’. If you do not have any others just choose ‘default’. With that said, let’s take a look at what happens when we edit our ‘Computers’ attribute set.

At first, this can be very confusing. What in the world are we looking at?

If you use another tab, go search a computer product in your catalog and edit it and you will see a bunch of tabs to your left such as ‘inventory’ and ‘shipping’ and ‘general’

Those tabs you see ARE the sections you see when editing an attribute. Look carefully in the ‘Groups’ section when editing your attribute. You see ‘General’ and below that is ‘Prices’. Those ‘groups’ ARE the tabs you see in your ‘edit product’ section.

The point of the attribute set is to say “Ok, you want to sell different types of products (computers, hardware, cameras/etc) and each product has different data that applies to that product (ram_size for computers, megapixels for cameras/etc). This is why you have different attribute sets because it allows you to organize product types in a way that ensures the fields of data you enter are specifically related to the product type. So, when we want to see ‘ram size’ in the ‘edit product’ section, for ‘computers’, since a computer is in the “Computers’ attribute set, we must add that ‘ram size’ attribute TO the proper ‘group’ or ‘tab’.


Need help setting up “Magento Attributes” on your Magento website? Contact us today to talk about how we can help you. We have a variety of solutions to fit MOST budgets! Fill out our contact form by clicking here and you will receive a response, typically within hours!

In our demo, to the right is the ‘unassigned attributes’, one being ‘ram size’. This is why ‘ram size’ is not showing up in our ‘general ‘tab’ when editing a product. We didn’t assign it to the general tab (group) yet so magento would not be able to load it there. So let’s do that right now. You see ‘ram_size’ below in the ‘Unassigned Attributes’ area. Let’s ‘move’ it to the ‘general’ group. All you do is put your mouse on ‘ram_size’ and move it to the ‘general’ group. Do this for any attribute you are adding to an attribute set. For instance, if you had an attribute called ‘special_price’ you would scroll down the ‘groups’ area and notice all of the ‘price’ attributes loading under ‘Prices’ (see below):

So, in this example I am going to move ‘ram_size’ into the ‘general’ tab and then save this attribute set. You may be asked to re-index your database. If so, that is ok just follow the link provided to you during the ‘alert’ message at the top of your admin panel and follow the instructions.

For instance, on the ‘re-index’ page you will see this:

See the red button ‘reindex required’ ? To the very far left of THAT row is a checkbox. Select it and then hit the ‘submit’ button and you will have re-indexed the database. When you are done you will be able to see any newly created attribute and newly added attribute to a product edit page. Just make sure to look inside the tab with the same name of the ‘group’ in which you moved the attribute to when editing the ‘attribute set’.

Let’s take a look:

The field is now listed at the bottom. Keep in mind, for my demonstration, I selected ‘yes’ for adding it in the product filtering menu in the category page so let’s go over there and see if it is available for filtering (Despite the fact that I have not added data yet, this will not matter as you will be adding that accordingly. This is just to show you how to get this new attribute to load in the ‘sort by’ filtering menu).

As of this moment, now that I have added my attribute to the proper ‘computers’ ‘attribute set’, re-indexed and added a value of ’44’ to my test computer I am now ready to filter by ‘ram_size’. Now it is up to you to add the value for such an attribute but now you at least now how to do this:

for any attribute (ram_size,special_price), for any product (computer 1, 2 or 3 or even camera 1, 2 and 3) and for any attribute set (camera, computer).

Please feel free to ask any questions if you are confused and feel free to offer feedback on what other tutorials you want to see on this website that can help you with your magento store.

Rate this post