我的Filterable (with results)
中的属性设置为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'
的行,因此永远不会显示该属性。为什么不将此属性编入索引?它是通过安装脚本创建的,而不是通过管理员创建的,因此可能会遗漏某个值。
答案 0 :(得分:1)
对此没有直接的答案。 走这条路:
删除其他条件并触发此查询并检查是否得到了结果然后在条件中添加一个并继续,直到找到导致所需行被消除的条件。
我看到的是: warehousecheckout_warehouses_idx.entity_id = e.entity_id AND warehousecheckout_warehouses_idx.attribute_id ='198' - attr id我想过滤 和warehousecheckout_warehouses_idx.store_id = '11'
也 AND cat_index.category_id ='11'
还有更多但是 应该是类别ID或商店ID。
答案 1 :(得分:1)
我能够使用
在eav表中手动创建条目insert into catalog_product_index_eav
select entity_id, attribute_id, 1, value
from catalog_product_entity_varchar
where attribute_id = 198;
insert into catalog_product_index_eav_idx
select entity_id, attribute_id, 1, value
from catalog_product_entity_varchar
where attribute_id = 198;
您必须为每个商店视图执行此操作。