Magento - 显示模式“静态块和产品”时显示/隐藏 CMS 块在类别中选择

发布于 2024-10-03 18:59:10 字数 204 浏览 1 评论 0原文

在我的顶级类别中,我想使用静态块和产品以及分层导航。我想要使​​用它的方式是,当没有选择任何分层导航选项时,仅显示静态块(toys.phtml),而如果选择任何选项,则隐藏静态块,仅显示产品(toys.phtml?brand=1)。

有人对此有什么建议吗?我很确定我可以隐藏产品(检查 URL 字符串中的 $_GET 变量),但不确定如何隐藏静态块。

提前致谢。

On my top level categories, I'd like to use both static blocks and products along with layered navigation. The way I want to use it is that when none of the layered navigation options have been selected, a static block only displays (toys.phtml), whereas if any of the options are selected, the static block is hidden and only the products display (toys.phtml?brand=1).

Does anyone have any suggestions for this? I'm pretty sure I can hide the products (check URL string for $_GET variables), but not sure how I can hide the static block.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烏雲後面有陽光 2024-10-10 18:59:10

您应该修改或覆盖 Mage_Catalog_CategoryController (viewAction) 并在 $this->renderLayout(); 指令之前添加以下内容:

if($this->getRequest()->getParam('brand'))
    $this->getLayout()->unsetBlock('yourstaticblockname');

You should modify or override the Mage_Catalog_CategoryController (viewAction) and add right before the $this->renderLayout(); instruction, add the following:

if($this->getRequest()->getParam('brand'))
    $this->getLayout()->unsetBlock('yourstaticblockname');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文