将cms块添加到产品页面

时间:2014-03-28 22:25:13

标签: xml magento layout

美好的一天,

我想替换[name =" product.info.simple" as =" product_type_data"]在单个产品页面上阻止CMS块。下面的最后一个例子[1]看起来很有希望。下面[2]是我尝试的布局更新XML。此布局更新确实删除了product_type_data块,但产品页面中缺少available_soon块。

是否可以使用XML布局更新将CMS块添加到单个产品页面?任何线索都会非常感激。

谢谢,

-Ben

[1] http://magebase.com/magento-tutorials/5-useful-tricks-for-your-magento-local-xml/

[2]

<reference name="product.info">
<action method="unsetChild">
<name>product_type_data</name>
</action>
<block type="cms/block" name="available_soon" before="-">
<action method="setBlockId"><block_id>available-soon</block_id></action>
</block>
</reference>

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

仔细检查静态块标识符是否可用_&#39;。

将以下内容添加到您的产品页面&gt;自定义布局:

<reference name="product.info">
 <action method="unsetChild">
  <name>product_type_data</name>
 </action>
 <block type="page/html" name="available_temp" as="available_temp" template="page/html/available_temp.phtml">
  <action method="setBlockId">
   <block_id>available_temp</block_id>
  </action>
 </block>
</reference>

在app / design / frontend / default / YOUR_THEME / template / page / html / available_temp.phtml创建以下文件 并输入以下行:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('available_soon')->toHtml(); ?>