我有一个设置为Filterable (with results)
in的属性Use In Layered Navigation
。我已经重新索引、清除缓存,甚至关闭了平面表,但我无法让它显示在过滤器上。
我已经在catalog_product_index_eav
表格中找到了所有其他可过滤的属性 ID,但我的却不见了。
我已经跟踪了这个查询,在该查询中Mage_Catalog_Model_Layer_Filter_Attribute::_getItemsData()
检查给定属性有多少产品。如果为空,则不显示属性
SELECT
`warehousecheckout_warehouses_idx`.`value`,
COUNT(warehousecheckout_warehouses_idx.entity_id) AS `count`
FROM `catalog_product_flat_11` AS `e`
INNER JOIN `catalog_category_product_index` AS `cat_index`
ON cat_index.product_id=e.entity_id
AND cat_index.store_id=11
AND cat_index.visibility IN(2, 4)
AND cat_index.category_id='11'
INNER JOIN `catalog_product_index_price` AS `price_index`
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1'
AND price_index.customer_group_id = 0
INNER JOIN `catalog_product_index_eav` AS `warehousecheckout_warehouses_idx`
ON warehousecheckout_warehouses_idx.entity_id = e.entity_id
AND warehousecheckout_warehouses_idx.attribute_id = '198' -- attr id i want to filter by
AND warehousecheckout_warehouses_idx.store_id = '11'
GROUP BY `warehousecheckout_warehouses_idx`.`value`;
但是没有行,attribute_id = '198'
因此该属性永远不会显示。为什么这个属性没有被索引?它是通过安装脚本创建的,而不是通过管理员创建的,因此可能在某处遗漏了某个值。