简体   繁体   English

Magento-如果只有1个可用,则隐藏分层导航属性

[英]Magento - Hide Layered Navigation Attribute if only 1 available

My store has numerous attributes in my layered navigation to allow customers to refine the product views/searches. 我的商店在分层导航中具有众多属性,以允许客户优化产品视图/搜索。 On some of my categories i only have 1 attribute present. 在我的某些类别中,我只有1个属性。 For example one of my categories - women > accessories > belts 例如,我的类别之一- women > accessories > belts

has: 拥有:

- 1 price option ($10.00 and above)
- 3 colour options (brown, tan, black)
- 1 brand option (Levi's)

How can I hide any filters that only have 1 value present. 如何隐藏仅包含1个值的所有过滤器。 So in this case instead of the above i would only want: 因此,在这种情况下,我只希望:

- 3 colour options (brown, tan, black)

to show in the layered navigation 显示在分层导航中

Replace in root/app/design/frontent/<package>/<theme>/template/catalog/layer/view.phtml in 49th row: 在第49行的root/app/design/frontent/<package>/<theme>/template/catalog/layer/view.phtmlroot/app/design/frontent/<package>/<theme>/template/catalog/layer/view.phtml

<?php if($_filter->getItemsCount()): ?>

With

<?php if($_filter->getItemsCount() && $_filter->getItemsCount()>1): ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM