Question

Does anyone know why meta_title attribute is missing both for product and category flat tables?

I can see meta_description and meta_keyword fields in the flat tables but no meta_title. So I am forced to use eav model, which is fine. But I was wondering why is this so. Also does anyone has a "fix" for this in order to add meta_title to the flat tables?

Was it helpful?

Solution

Open 'meta_title' attribute in admin, set "Use in product listing" as Yes, and then try re-indexing. AFAIK, Only attributes selected to be "Used in Product Listing" get included in flat tables.

OTHER TIPS

You can do this by adding meta_title attribute at frontend/product/collection/attributes node at config.xml

<frontend>
     <product>
         <collection>
             <attributes>
                 <meta_title/>
             </attributes>
         </collection>
     </product>
</frontend>

Explanation:

Let explain:

First look at class Mage_Catalog_Model_Resource_Product_Flat_Indexer .

and a function name getAttributeCodes() which responsible for columns creation at catalog product flat.

Magento is first take the attributse from global/catalog/product/flat/attribute_nodes using

Mage::getConfig() ->getNode(self::XML_NODE_ATTRIBUTE_NODES) ->children();

from config.xml at app/code/core/Mage_Catalog/etc/

 <flat>
                    <max_index_count>64</max_index_count>
                    <attribute_nodes>
                        <product_collection>frontend/product/collection/attributes</product_collection>
                    </attribute_nodes>
                    <add_filterable_attributes>0</add_filterable_attributes>
                    <add_child_data>0</add_child_data>
                    <flag>
                        <model>catalog/product_flat_flag</model>
                    </flag>
                </flat>

Which internally call config node: frontend/product/collection/attributes.

If we define an attribute here then this attribute will automatically added as columns in flat table.

 <frontend>
        <product>
            <collection>
                <attributes>
                      <attribute_Code/>
                </attributes>
            </collection>
        </product>
    </frontend>

Then need to product flat index form index management.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top