Magento has a flexible system to work with products. When you sell, for example, a board game and a computer, the specifications of each product are different. Suppose I want to configure an age for the board game and a screen resolution for the computer. In such cases, these thingsare covered with attributesand attribute sets.
When you create a product, you have to first select an attribute set (with specific attributes) before entering other data.
Go to the backend and navigate to Catalog| Attributes| Manage Attributesand Catalog|Attributes| Manage Attribute Sets.
We will create some extra attributes and an attribute set on these pages.
How to do it…
In the next steps, we will create extra product attributes that we can use with an attribute set:
1. Create a new attribute on the Manage Attributespage.
2. After you click on New Attribute, fill in the form as follows:
Attribute Code: available_from(the code of the attribute used in the database and functions)
- Scope: Store View(this setting adds the ability to specify a separate value for each store view)
- Catalog Input Type for Store Owner: Date(this is the type of the attribute)
- Default Value: empty
- Unique Value: No
- Values Required: No
- Apply To: All Product Types
- Use in Quick Search: No(this option searches through the attribute values while performing a quick search)
- Use in Advanced Search: No(this option makes the attribute available to search on in the Advanced searchoption)
- Comparable on Front end: No(this option shows the attribute in the product comparing tool)
- Use for Promo Rule Conditions: No
- Position: empty
- Visible on Product View Page on Front-end: Yes(this option shows the attribute value on product pages)
- Used in Product Listing: No(this option makes the attribute value available on category pages)
- Used for sorting in Product Listing: No(this option makes the attribute available to sort on category pages)
3. In the Manage Label / Optionsfield, fill in the labels for the frontend.
4. Click on Save Attributeand the attribute is saved.
5. Create a new attribute set by navigating to Catalog| Attributes| Manage Attribute Sets.
6. Fill in the form as follows and click on Save Attribute Set:
7. The attribute set overview opens. Onthis page, you can drag-and-drop the attributes in the appropriate groups.
8. Create a group named Game specific dataand drag the available_from, memory, and processor attributes to it.
9. Save the attribute set.
10. Create a newproduct in Manage Products from Catalog, and enter the following configuration:
- Attribute Set: Games
- Product Type: Simple Product
11. Click on Continue.
You will see that the special game attributes are now available in the Game specific data tab:
How it works…
Attributes and attribute sets are used when you work with multiple families of products. In the sample data of our shop, there are more attribute sets available for cameras, computers, shirts, shoes, and more.
With attribute sets, you can group attributes of a family with each other.
While creating a new attribute, you will have to specify the type of the attribute. The following
types are available with different inputs and outputs:
- Text field
- Text area(a text field with multiple lines)
- Yes/ No
- Multiple Select
When you will use an attribute as a filter in the left navigation on the category pages, this attribute must have the type Dropdown, Multiple Select, or Price.
Ready to foster your knowledge with MAGENTO 2 BASIC GUIDE