Tutorial: Creating Attributes (custom fields)

So you’re ready to add some custom data to your products?  Luckily, this isn’t complicated.  Today we’re going to create an attribute called “Hard Drive Size” for the external hard drives we’re about to sell in our store, and also an attribute called “Manufacturer” to use in our layered navigation.  Let’s start with the simpler one - Hard Drive Size.  In the front-end, this will appear on products like “Hard Drive Size:  {whatever options you create and select}” - For example: “Hard Drive Size: 100GB”.

Creating a simple attribute - Hard Drive Size

  1. Log into the Magento admin panel
  2. Navigate to “Manage Attributes” under Catalog -> Attributes -> Manage Attributes
  3. In the top right, click on “Add New Attribute”
  4. You’re now on the Attribute edit page and Properties tab.  It looks like this:

Properties Tab

image

  • Use in quick/advanced search: If “yes”, the data saved in this attribute will be searchable in the front-end in the quick search and advanced search, respectively (ie, if i type “100GB” it should return all products with this value saved in the Hard Drive Size field).
  • Comparable on Front-end: If “yes”, this attribute will be displayed in a product comparison, so long as at least one product in the Compare List contains a value for this attribute.
  • Use in Layered Navigation: If “filterable”, this data will be available as a filter in Magento’s layered navigation. Filterable (with results) means that only values that are associated to specific products in a given category page will list in the Layered Navigation menu. Filterable (no results) means that all existing values for an attribute will display in the menu, even if using this as a filter will produce no results. There’s one condition to use attributes in layered navigation - the Input Type has to be Dropdown, Multiple Select, or Price.
  • Position: This determines the position of this attribute in the Layered Nav menu.
  • Visible on Catalog Pages on Front-end: If “no”, this attribute will not be displayed in the product info page. The “visibility” only controls whether or not the attribute displays in the front-end. Keep in mind - if you set an attribute to “Visible: No”, and leave it as “Comparable: Yes”, this attribute will still show up in comparison charts.

  • Manage Label / Options

    image
    Under this tab, you can enter the label for the attribute in the front-end.  If you control stores in multiple languages, you can enter the label in each language under this tab.  If a store’s label is blank, this store will look to the default label and use this one.  Here we’ll enter “Hard Drive Size” under “Default”.

    Frontend Properties

    Click here to see how the attribute appears in the front-end.

    Creating an attribute with controlled options - Manufacturer

    The next attribute we’ll create is going to be “Manufacturer.” Let’s say you carry televisions by 4 manufacturers.  Rather than having to type the name of each manufacturer, why not just make it an attribute and assign four possible options to it:  Varien, Panasonic, JVC, and Sony.

    Attribute Properties

    For our “Manufacturer” attribute, we’ll use Catalog Input Type “Dropdown” since we want this attribute to have limited data.  Using “Dropdown” also enables us to show the attribute as a layered navigation filter.  Below is what the Properties tab looks like for “Manufacturer”:
    image

    Manage Label/Options

    Since we select Dropdown as the input type, we have the ability to create the possible options for this attribute from this tab.  Under “Manage Labels” tab is “Manage Options”.  Press “Add Option” to add an option.  It functions similarly to labels - any blank fields will look to the “default”.  You can also set the positions of each value and select one of the values as the default. See below for how it looks after adding four manufacturers as options.
    image

    Applying to a product

    Now, to apply this selectable attribute to a product, just add it to an attribute set and create a new product using this set.  Below is a simplified example of the General tab of creating a new product in the admin:
    image

    Front-end

    Click here to see how the attribute appears in the front-end.
    image

    Mmm, nice.  Now you’ll never have to type these manufacturers again.  Also, data entry will be more consistent, since it is impossible to have a typo or spelling error if a drop-down is used.