我需要编写一个Observer来显示Product details页面底部的产品块。
所以,我已经写过捕获事件' catalog_product_load_after '。但我需要创建一个自定义块,可以通过产品详细信息页面中的getChildHtml()调用。
任何帮助将不胜感激。
答案 0 :(得分:2)
It sounds like you don't need an observer at all if the event you're waiting to fire is simply for the product details / view page to load? I might be wrong but please provide the context and gist of what you want to happen.
I assume you want to add a static block to the bottom of a product's view? If so, no need to add an observer.
To use getChildHtml('block_name')
, you need to define it in your theme's catalog.xml. Add the following within <reference name="content">
of the layout handle catalog_product_view
:
<block type="cms/block" name="block_name">
<action method="setBlockId"><block_id>block_identifier</block_id></action>
</block>
Then, in your product view.phtml, you can add:
<?php echo $this->getChildHtml('block_name'); ?>
in the place you want it to appear.