Magento - 使用分层导航时隐藏类别页面上的静态 CMS 块
我有一个 magento 网站。我们正在使用分层导航,我想将静态内容与结果一起添加到类别登录页面。我已经添加了 cms 块,它在主类别页面上看起来很棒(未应用过滤器)。但是,静态块在应用分层导航过滤器后显示,这是我不想要的。
应用任何过滤器时如何隐藏静态 cms 块?
我尝试在category/view.phtml 中加载过滤器,但似乎不知道如何加载和检查。另外,我不能简单地检查 GET 参数,因为分层导航中使用的属性可能会发生变化。
关于如何实现这一目标有什么想法吗?
I have a magento site. We are using layered navigation and I would like to add Static content to the category landing page along with results. I have added the cms block and it looks great on the main category page (no filters applied). However, the static block shows after applying layered navigation filters, which I don't want.
How can I hide the static cms block when any filter is applied?
I tried loading the filters in the category/view.phtml, but can't seem to figure out how to load and check. Also, I can not simply check GET parameters because the attributes used in layered navigation may change.
Any ideas on how to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能想到的实现此目的的最懒的方法是在“清除所有过滤器”按钮旁边的过滤导航前端模板中包含一些脚本。该脚本可以在 DOM 加载事件上运行,然后 Prototype 隐藏您的 div。
通过这种方式,静态块仅显示过滤导航中缺少清除所有按钮的情况 - 即未应用过滤器时。如果您在 DOM 加载事件上执行此操作,则不应出现“闪烁”或任何其他表明某些内容已被隐藏的迹象。
我知道这不是一个完整的示例,如果您遇到困难,请告诉我......
The laziest way I can think of to achieve this is to include some script in the filtered navigation frontend template next to the 'clear all filters' button. This script could run on DOM load event and then Prototype hide your div.
In this way the static block only shows if the clear all button is missing in the filtered navigation - i.e. when no filters are applied. If you do it on the DOM load event there should be no 'flash' or any other sign that something haves been hiddens.
I know that is not a fully worked example, let me know if you get stuck...