Magento Shortcode CMS块在产品页面上不起作用

编程入门 行业动态 更新时间:2024-10-28 12:20:46
本文介绍了Magento Shortcode CMS块在产品页面上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在Magento产品页面上添加CMS块.

I am attempting to add a CMS block on a Magento product page.

我正在使用的简码是:

{{block type="cms/block" block_id="myproductblock"}}

该块显示为文本.它不会插入CMS块.我已确保禁用了所见即所得编辑器.

The block shows up as text. It does not insert the CMS block. I have made sure that the WYSIWYG editor is disabled.

推荐答案

我假设您要将其添加到product.phtml

I assume you want to add it to product.phtml

为此,您需要编辑layout/catalog.xml

To do this, you need to edit the layout/catalog.xml

... <catalog_product_view> .. ... <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml"> <!-- start your code: --> <block type="cms/block" name="myproductblock" before="-"> <action method="setBlockId"><block_id>myproductblock</block_id></action> </block>

然后在您的view.phtml中编写:

Then inside your view.phtml you write:

<?php echo $this->getChildHtml("myproductblock") ?>

"myproductblock"与您在layout.xml中指定的名称相同的地方

Where the "myproductblock" is the same as the name you specified inside the layout.xml

此后,您必须清除layout.xml缓存,它应该可以工作:)

After this you have to clear the layout.xml cache and it should work :)

为什么您的代码不起作用: 这些.phtml文件都是php脚本."{{"和}}"必须由模板引擎解释,并且仅在电子邮件,CMS页面/块和后端的所见即所得编辑器内部有效.

Why your code didn't work: Those .phtml files all are php-scripts.. the "{{" and "}}" must interpreted by a template engine and is only valid inside emails, CMS pages/blocks and the wysiwyg editors in the backend.

更多推荐

Magento Shortcode CMS块在产品页面上不起作用

本文发布于:2023-07-20 17:40:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1169631.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上不   页面   产品   Magento   Shortcode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!