Magento Categories and Attributes — Catalog Structure and EAV Architecture
In this tutorial, you'll learn how to organize your Magento catalog using categories and attributes, how the EAV architecture makes Magento flexible, and how to create attribute sets for different product types.
What You'll Learn
- Creating and organizing categories in the category tree
- Understanding anchor vs non-anchor categories for layered navigation
- Configuring category display settings, permissions, and sort options
- Managing attribute sets and assigning them to products
- How the EAV (Entity-Attribute-Value) architecture works
- Creating custom product attributes with appropriate input types
- Attribute properties: scope, visibility in search, and layered navigation
Why It Matters
Categories and attributes form the backbone of your catalog structure. Well-organized categories help customers find products quickly, leading to higher conversion rates. Properly configured attributes power the layered navigation that lets customers filter by size, color, price, and brand. Understanding the EAV architecture is essential because it explains why Magento can handle arbitrary product attributes without database schema changes.
Real-World Use
A clothing retailer adds a new product category "Winter Coats" for the seasonal collection. They want customers to filter coats by size, color, material, and warmth rating. The category must show subcategories (Down Coats, Wool Coats, Rain Jackets) in layered navigation. Using anchor categories and custom attributes, the retailer creates this filtering experience without writing any code.
Learning Path
flowchart LR A["Product Types"] --> B["Categories & Attributes
← You are here"]:::current B --> C["Pricing & Catalog Rules"] C --> D["Inventory & Stock"] D --> E["Cart & Checkout"] classDef current fill:#38bdf8,color:#0f172a,stroke-width:2px
Category Management
The category tree is at Products > Categories. This panel shows all categories in a hierarchical tree. The tree starts with a root category assigned to each website.
Each Magento website has exactly one root category. The root category contains the entire category tree for that website. For multi-store setups, each website can have its own root category with a different product assortment.
To add a category, click Add Subcategory under the parent. The category form has several sections:
Category Settings
General settings:
- Name — Displayed on the storefront
- URL Key — Used in the category URL path. Auto-generated from name but can be customized
- Include in Menu — If yes, the category appears in the top navigation
- Active — Must be Yes for the category to appear on the storefront
Display settings:
- Display Mode — Three options:
- Products Only — Shows product grid
- Static Block Only — Shows a CMS block (for landing pages)
- Static Block and Products — Shows a CMS block above the product grid
- Anchor — Controls layered navigation behavior (see Anchor vs Non-Anchor below)
Category options:
- Available Sort By — Add to cart, price asc/desc, product name, newest
- Default Sort By — The default sort order when customers visit the category
- Layered Navigation — Configure which attributes appear in filters (price, attributes)
Category products:
- Products in Category — Search and assign products from the catalog
- Sort Order — Drag and drop to reorder products manually
Category permissions (requires configuration):
- Display Product Prices — Per customer group
- Allow Adding to Cart — Per customer group
Design settings:
- Apply a custom theme or layout to the category page
Anchor vs Non-Anchor
This is one of the most important category concepts in Magento.
Anchor category — Yes means the category displays layered navigation (filters) on the left side. The layered navigation shows both the category's own attributes and subcategory links. Customers can filter by price, size, color, brand, or any attribute configured for layered navigation. Anchor categories also show product counts for subcategories.
Non-Anchor category — No means the category is a simple landing page. Layered navigation is not displayed. Products appear in a grid or list with sorting options. Subcategory links are not shown as filters.
Use anchor for categories where customers need to filter products. Use non-anchor for simple categories where filtering is unnecessary, such as a "New Arrivals" page with a limited product set.
| Feature | Anchor | Non-Anchor |
|---|---|---|
| Layered navigation filters | Yes | No |
| Subcategory links in navigation | Yes | No |
| Product count per subcategory | Yes | No |
| Best for | Large catalogs needing filtering | Small curated sets |
Attribute Sets
An attribute set is a collection of product attributes grouped together for a specific product type. Instead of showing every possible attribute on every product form, Magento groups attributes logically.
Go to Stores > Attributes > Attribute Sets to manage them.
The default attribute set is "Default," which includes common attributes like name, SKU, price, weight, and description. For specialized products, create custom attribute sets:
- Clothing set: Add Color, Size, Material, Sleeve Length, Fit
- Electronics set: Add Brand, Processor, RAM, Storage, Screen Size
- Furniture set: Add Material, Color, Assembly Required, Dimensions, Weight Capacity
Within an attribute set, attributes are organized into groups. The Default group contains basic attributes. You can create custom groups like "Technical Specifications" or "Shipping Dimensions."
Each product is assigned to exactly one attribute set. You cannot change the attribute set after product creation. Plan your attribute sets carefully.
EAV Architecture
The Entity-Attribute-Value (EAV) architecture is Magento's approach to storing product and customer data. Instead of a traditional database schema where each product attribute is a column in a table, EAV stores each attribute value as a row.
Traditional database (flat model):
| product_id | name | sku | price | color | size | weight |
|---|---|---|---|---|---|---|
| 1 | T-Shirt | TS001 | 19.99 | Red | M | 0.2 |
EAV model:
| entity_id | attribute_id | value |
|---|---|---|
| 1 | 1 (name) | T-Shirt |
| 1 | 2 (sku) | TS001 |
| 1 | 3 (price) | 19.99 |
| 1 | 4 (color) | Red |
| 1 | 5 (size) | M |
| 1 | 6 (weight) | 0.2 |
The advantage of EAV is flexibility. Adding a new attribute like "Warmth Rating" or "Waterproof Rating" does not require adding a column to a database table. You simply create a new attribute in the admin, and Magento auto-creates the corresponding EAV tables.
The trade-off is performance. EAV requires joins across multiple tables to load a complete product. This is why Magento uses indexing — the flat catalog index converts EAV data into flat tables for fast front-end queries.
Magento uses EAV for:
- Products (catalog_product_entity_*)
- Customers (customer_entity_*)
- Customer Addresses (customer_address_entity_*)
- Categories (catalog_category_entity_*)
Product Attributes
Product attributes are the building blocks of your catalog. Go to Stores > Attributes > Attributes to manage them.
System attributes are created by Magento and cannot be deleted. Examples: name, SKU, price, weight, status, visibility.
Custom attributes are created by you. Examples: color, size, material, brand, manufacturer.
When creating an attribute, you configure these properties:
| Property | Options | Purpose |
|---|---|---|
| Scope | Global, Website, Store View | Where the attribute value applies |
| Input Type | Text, Select, Multiselect, Dropdown, Swatch, Price, Media, Date | How the value is entered |
| Required | Yes/No | Must be filled before saving |
| Used in Product Listing | Yes/No | Shows in category product grid |
| Used in Layered Navigation | Yes/No | Appears as filter in layered nav |
| Comparable | Yes/No | Visible in compare products |
| Searchable | Yes/No | Included in catalog search |
| Visible in Advanced Search | Yes/No | Shows in advanced search form |
| Use in Promo Conditions | Yes/No | Available for catalog/cart rules |
Creating a Custom Attribute
To create a custom attribute:
- Go to Stores > Attributes > Attributes.
- Click Add New Attribute.
- Enter the Attribute Code (system name, no spaces).
- Set the Catalog Input Type for Store Owner (dropdown, text, swatch, etc.).
- Configure the attribute properties (scope, required, searchable).
- Add attribute values if using dropdown or multiselect.
For example, a "Brand" attribute:
- Attribute Code:
brand - Input Type: Dropdown
- Values: Nike, Adidas, Puma, Under Armour
- Scope: Global
- Used in Layered Navigation: Yes
- Used in Product Listing: Yes
- Searchable: Yes
After creating the attribute, assign it to the appropriate attribute set (Stores > Attributes > Attribute Sets).
Common Mistakes
Using non-anchor categories for large catalogs. A category with 200 products and no layered navigation forces customers to scroll endlessly. Always use anchor for categories with more than 20 products that have varying attributes.
Creating too many attribute sets. Each attribute set adds complexity. Beginners create a separate set for every small product variation. Instead, use one attribute set per major product category (Clothing, Electronics, Furniture) and manage optional attributes through input type settings.
Setting the wrong scope on attributes. Setting an attribute to Store View scope when it should be Global causes maintenance headaches. Price should be Global (same everywhere). Product descriptions might be Store View (different languages). Plan scope before creating attributes — changing scope later requires data Migration.
Not indexing after attribute changes. Creating or modifying attributes requires reindexing. Without reindexing, new attributes may not appear in layered navigation or search results. Run
php bin/magento indexer:reindexafter attribute changes.Deleting attributes used in attribute sets. If an attribute is used in any attribute set, deleting it breaks the product edit form for all products using that set. Check attribute usage before deleting.
Practice Questions
What is the difference between an anchor and a non-anchor category? Answer: An anchor category displays layered navigation filters (price, attributes, subcategories) and shows subcategory product counts. A non-anchor category displays products directly without filters. Use anchor for categories with many products needing filtering.
Why does Magento use the EAV architecture instead of flat database tables? Answer: EAV allows unlimited product attributes without schema changes. Adding a new attribute in the admin panel does not require adding a MySQL column. The trade-off is performance, which Magento addresses with flat catalog indexing.
What is an attribute set and why would you create custom ones? Answer: An attribute set is a group of attributes assigned to a product type. Custom sets let you show relevant attributes for different product categories (Clothing: color, size; Electronics: processor, RAM) without cluttering the product form with irrelevant fields.
Challenge: Design a complete attribute and category structure for a sporting goods store selling shoes, apparel, equipment, and accessories. Create four attribute sets (Shoes, Apparel, Equipment, Accessories), define the attributes for each (size, color, sport type, material, brand), and build a category tree at least three levels deep. Assign each attribute to the correct scope and configure layered navigation settings.
FAQ
Mini Project
Your task: Build a complete category and attribute structure for a furniture store.
- Create a root category "Furniture" with these subcategories:
- Living Room (anchor): Sofas, Coffee Tables, TV Stands
- Bedroom (anchor): Beds, Dressers, Nightstands
- Dining Room (anchor): Dining Tables, Chairs, Buffets
- Office (anchor): Desks, Office Chairs, Bookshelves
- Create a "Furniture" attribute set with these custom attributes:
- Material (dropdown: Wood, Metal, Glass, Fabric, Leather)
- Finish (dropdown: Oak, Walnut, White, Black, Natural)
- Assembly Required (Yes/No)
- Dimensions (text area)
- Weight (text)
- Assign attributes to the correct groups in the attribute set.
- Create test products in each category with the relevant attributes.
- Configure layered navigation to filter by Material, Finish, and Price.
This exercise gives you hands-on experience with the catalog structure that powers every Magento store.
What's Next
Now that you understand categories and attributes, learn how Magento handles pricing and promotions:
Continue to Lesson 7: Pricing and Catalog Rules — Special prices, tier pricing, and promotions.
Related lessons:
- Product Types — The product types that use these attributes
- Tax Configuration — How tax interacts with product pricing
- {{< ilink "MySQL" "MySQL" "MySQL and EAV" >}} — Database performance for attribute queries
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro