Magento Forum

How to add static product attribute to catalog flat table ? 
 
mfoillard
Member
 
Total Posts:  67
Joined:  2008-08-04
 

Dear all,

After adding new static attribute to catalog_product_entity, how to make catalog product flat indexer add this attribute to flat table ?

We modified Mage_Catalog_Model_Resource_Product_Flat_Indexer::_getFlatColumnsOldDefinition() in order to make the indexer add our column when creating flat table. The indexer successfully add this new column in catalog_product_flat_*
The problem is that indexer does not copy column\’s data from catalog_product_entity to catalog_product_flat_*

We then tried to add our attribute in app/code/core/Mage/Catalog/etc/config.xml in section frontend/product/collection/attributes (called from section global/catalog/product/flat/attribute_nodes) without success.

Any hints ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Moderator
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

If you want an product attribute to be listed in catalog flat tables then you need to do the following things (AFAIK):
1> Create atttribute of non-static type (ie. varchar, int, decimal, text etc which suits for you)
2> In the attribute properties: Select Used in Product Listing = Yes
3> Re-index
4> That’s all

 
Magento Community Magento Community
Magento Community
Magento Community
 
mfoillard
Member
 
Total Posts:  67
Joined:  2008-08-04
 

Thanks but we want to add in flat table _static_ attribute (e.g. in the catalog_product_entity table), not an EAV attribute

I finally find what’s wrong, we missed to insert data in catalog_eav_attribute saying this attribute is visible in front
Now the indexer add the attribute value in the new column in catalog_product_flat_*

After doing so, the indexer will finally do the job

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top