Summary: Is there any action required to pull data from "child products" into configurables on flat tables other than setting
global/catalog/product/flat/add_child_data to 1?
App: Magento 18.104.22.168
Action: Reindexing Catalog Product Flat table with n98-Magerun
More detail follows...
In order to pull a configurable products associated simple data into the flat table, I have set the config value of
global/catalog/product/flat/add_child_data to '1'.
This configuration value is read by
Mage_Catalog_Helper_Product_Flat::isAddChildData(), which itself is used by
Enterprise_Catalog_Helper_Product::getFlatColumnsOldDefinition and others. These classes use the predicate to properly generate the structure for the resulting flat table, and the temporary indexing tables.
The problem I'm having is that the Product Refresh Model's
_fillTemporaryFlatTable method attempts to insert into the temp table (which now includes
child_id) without providing data for that column. This occurs even though that column has a FK constraint on the
catalog_product_entity table. Needless to say, the attempted insert fails with a scary-looking
SQLSTATE: Integrity constraint violation message. This is occurring during an n98-Magerun
index:reindex catalog_product_flat run.
So far, I've searched DDG and Google for both (and variations on)
but none of those searches yielded useful results. The closest to useful result I found was this blog post by the Excellence Magento Blog. The following excerpt summarizes my goal:
‘global/catalog/product/flat/add_child_data’ : if this is set to 1, two column are added ‘is_child’ and ‘child_id’. Both these store relationship between configuration, grouped, bundled and its associated simply product.
Here's what I've found so far:
- When enabling
is_childare added to the flat columns used in the temporary and resultant flat tables
- However, adding child data does not appear to affect the select statement that reads from various product attribute tables
- This results in a foreign key constraint violation where the
child_idcolumn isn't present in the data which would be "inserted from select"
I'm primarily looking at
Enterprise_Catalog_Model_Index_Action_Product_Flat_Refresh::_fillTemporaryFlatTable right now, trying to figure out where in that method (or a previous one, maybe?) the
child_id data would be added to the select.
Thanks a bunch for reading. Hope this makes some sort of sense!