开发者

Magento - Hide Static CMS block on Category Page when using layered navigation

开发者 https://www.devze.com 2023-03-10 10:45 出处:网络
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 c

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 c开发者_如何转开发an not simply check GET parameters because the attributes used in layered navigation may change.

Any ideas on how to accomplish this?


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消