把某个属性的Use in Layered Navigation改成No,清了缓存,分类页左侧仍然出现该筛选。先确认看到的是Magento原生layered navigation,还是第三方模块生成的聚合;两套配置和索引不能混着处理。

从属性本身核实

SELECT attribute_id,attribute_code,frontend_input
FROM eav_attribute WHERE attribute_code='material';

SELECT is_filterable,is_filterable_in_search,is_searchable
FROM catalog_eav_attribute WHERE attribute_id=<attribute_id>;

is_filterable应为0。若后台保存后数据库没变,检查属性是否被锁定、自定义backend model是否回写旧值,以及保存时操作的是否是正确环境。

原生导航的处理顺序

  1. 重建catalog_product_attribute和catalogsearch_fulltext索引;
  2. 清理block_html与full_page缓存;
  3. 清Varnish或CDN对应分类URL;
  4. 无痕窗口打开分类页,确认响应不是旧HTML。
bin/magento indexer:reindex catalog_product_attribute catalogsearch_fulltext
bin/magento cache:clean block_html full_page

第三方导航仍有一份配置

扩展通常有自己的属性表或索引。到扩展配置中关闭该Filter,再运行它提供的reindex命令。不要猜表名后直接DELETE;先查模块文档和setup schema,并在测试环境验证。

判断是不是模板写死

grep -R "material\|attribute_code" app/design app/code -n

若前端显示的只是自定义CMS筛选链接,它不会读取is_filterable。改模板或CMS块,并确保链接参数与当前搜索路由一致。

验收时既要看分类页,也要看搜索结果页,因为Use in Layered Navigation与Use in Search Results Layered Navigation是两个设置。