Categories


Archives


Recent Posts


Categories


Configurable Product Research

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Whenever I’m about to tackle a Magento project and/or feature that requires deep knowledge of a new-to-me subsystem, I spend a half-day to a day writing up something like the information below. Sort of an anti-UML, it’s a high level narrative of the relationships between particular objects and systems in Magento.

Beyond creating tangible documentation I can come back to later, getting my thoughts and understanding out onto paper-or-bits like this helps surface technical misunderstandings I have about the particular system implementation, providing areas for further research (the QUESTION)

These aren’t exactly the greatest for public documentation, as I don’t spell out non-obvious things that are obvious to me, and there may even be blatant errors. Regardless, maybe there’s some useful information in there for someone, so onto quickies it goes.

Configurable Product Notes

Magento products entities have an attribute set. This determines which “fields” a product has. (name, sku, size, etc.). The is tracked by the attribute_set_id column on the main product entity table.

An attribute set is an object that keeps track of a list of attributes. Attributes are also objects.

A configurable product entity in Magento is a product that allows store customers to set a value for a particular attribute (size). This attribute value will then be linked to a separate simple product entity.

For example, a configurable product entity of “Cool T-Shirt” may have an attribute set which contains an attribute named “size”. This attribute has three values (S, M, L). Upon selecting a size (M), the store customer is actually purchasing a separate, simple product entity whose size attribute is set to M.

Configurable products allow you to logically group individual simple product SKUs together as one product, but still alter individual properties of the simple product independent of the configurable product. (weight, stock management, etc.).

When creating a configurable product, you must set which attributes from the attribute set are configurable. By “are configurable”, we mean configurable by the store customer, and each valid selection by the store customer will be linked to individual simple products. To be eligible for use in a configurable product like this, an attribute must

  1. Have scope of “Global”
  2. Have an input type of “Dropdown”
  3. Have its “Use To Create Configurable Product type” property set to “Yes”

Attributes that do not have these characteristics are not eligible. For attributes that are not eligible, and for attributes that are NOT selected to be end-user configurable at product creation time, the store owner must enter values for these attributes on the backend.

The attributes that are store-user configurable are stored in the database table catalog_product_super_attribute. As such, you could also refer to these attributes as “super attributes”.

When you create a simple product with the intention of linking it to a configurable product, it must have the same attribute set as the configurable product. Also, it must have a value set for any attributes that are “super attributes” of the parent configurable product.

Linking a simple product to configurable product creates a parent/child relationship between the products. The configurable product is the parent, the simple product is the child. Magento appears to keep track of this relationship in two different tables. The first is the catalog_product_relation table, the second is the catalog_product_superlink_table. At this time it is unclear to the author why this relation is stored in two places. Speculating though, the catalog_product_superlink_table may be intended to specifically convey a configurable/simple-option relationship, whereas the catalog_product_relation table may be intended to track general parent/child relationships across all product types (grouped, etc). Bears further research.

QUESTION: Also, do other parent/child products have multiple relation tables? When is the relation table used vs. the super link table? What happens if they get out of sync?

The above tables are the only links created between configurable products and the simple products. The relationship between simple products and attributes is inferred. For example, you have a configurable product with a super attribute of size. The size attribute has three possible values, S, M, L. However, you only have two simple products. One with a size of S, and the other with a size of L. When Magento displays this product for sale, it will infer from the simple product that the only available sizes are S and L. An option for medium will not be presented.

QUESTION: What happens if you have multiple simple products with the same attribute value set?

The UI for managing the product relationships is on the standard product editing page, in the Associated Products tab, typically the last tab on the left. You use the grid at the bottom of this page to select which simple products should be associated with your configurable product. Clicking on “Reset Filter” will give you a full list of eligible products. Remember, products need the same attribute set.

This tab also gives you the ability to “Create Simple Associated Product”. This will open a popup window with a simple product, already with the right attributes set, ready to have you enter values.

This tab also gives you the ability to automatically generate one simple product for each option.

Pricing of a configurable product is tricky. The base price comes from the price of the configurable product entity. The simple product entity is not used to generate the price of the options. If you want options to have a separate price, you use the Associated Products to set a price modifier on each options. For example, using our S, M, L option, a S may have a price modifier of $2, a medium a price modifier of $4, and an L a price modifier of $6. Assuming a base price of $15 on the configurable product entity, this means a small shirt would cost $17, a medium shirt $19 dollars, and a large shirt $21.

These pricing modifiers are stored in the catalog_product_super_attribute_pricing table, which relates back to the catalog_product_super_attribute table, which is what relates back to the product entity. (and this product will be the configurable product).

Finally, the Associated Product tab will allow you to set a custom attribute label. This allows you to change the attribute’s label on the product listing page. This custom label is stored in the catalog_product_super_attribute_label table.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 15th December 2011

email hidden; JavaScript is required