Deep dive on the Magento internals here, not looking for a solution to a concrete problem, just trying to understand some implementation details.
When you create a Configurable Product in Magento, and then create child Simple Products to implement things like shirt size, color, etc., Magento stores this relationship in two separate tables.
catalog_product_relation
catalog_product_superlink_table
Why are these relationships stored twice?
Is this legacy code, or is there a semantic distinction between a product relation link and a product "superlink" link?
Does the system expect these to be the same, or is it a valid object state to have these tables representing different parent/child relationships?
Why is great question. The catalog_product_super_link
table only contains data related to configurable products. catalog_product_relation
also contains the relation information for bundled and grouped products, in addition to the configurable relations.
All the business logic revolving around configurable products refers to the catalog_product_super_*
tables, e.g. finding the configurable attributes and price updates for a configurable product.
The catalog_product_relation
table in contrast is used by classes not specific to configurable products, like the abstract catalog product indexer classes.
It seems that the Magento core team wanted to separate the logically distinct functionality not only into separate PHP classes, but also into separate database tables. Possible advantages? I guess theoretically it is easier this way to change the configurable product implementation without disrupting the indexer implementation.
This is just a guess - I haven't confirmed that or spoken with someone who "knows" (mental-note-for-imagine)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With