Magento: The Flat Catalog module has a limit of 64 filterable and/or sortable attributes. 错误

批量导入Magento attributeSets和Attributes之后,在重建索引的时候出现了这个错误:

The Flat Catalog module has a limit of 64 filterable and/or sortable attributes. Currently there are 772 of them. Please reduce the number of filterable/sortable attributes in order to use this module

字面上理解是Magento对于可筛选或排序的属性字段有数量限制 TAT!

排查了下,发现是在“/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php” 这文件里头的prepareFlatTable函数抛出的错误。

限制数64是在配置文件:"app/code/core/Mage/Catalog/etc/config.xml" 里,搜索“max_index_count”就会发现有段配置:

<global>
    <catalog>
        <product>
            <flat>
                <max_index_count>64
</max_index_count>
            </flat>
        </product>
    </catalog>
</global>

修改限定值64为大于772的数字后,重建索引报错“Cannot initialize the indexer process.”

由此预测这个值应该是不能改的,解决办法只好从 filterable和sortable 的字段入手,重新导入,并限制64个以内的可筛选和可排序字段。。

具体为is_filterable和used_for_sort_by都设为0再导入magento属性集和属性

另外也可以在表catalog_eav_attribute中查出is_filterable = 1和used_for_sort_by = 1的记录

限制64以内了也就解决了The Flat Catalog module has a limit of 64 filterable and/or sortable attributes.这错误。。