【发布时间】:2013-10-23 17:09:09
【问题描述】:
我看到了这个答案Static block on home page in Magento,但无法让它发挥作用。
我只是想在我的主页中添加一个自定义块。这些是我做过的事情:
1- 将此添加到我的布局文件中。
<cms_index_index>
<reference name="content">
<block type="aitshopassist/assistant" name="aitshopassist_assistant" template="aitshopassist/assistant.phtml">
<action method="setBlockId"><block_id>shop_assistant_block</block_id>
</action>
</block>
</reference>
</cms_index_index>
2- 将此添加到 2columns-right.phtml 文件中:
<?php echo $this->getChildHtml('shop_assistant_block') ?>
此外,该块在 catalog_category_view 中正确显示。
我错过了什么?
<catalog_category_view>
<reference name="content">
<block type="aitshopassist/assistant" name="aitshopassist_assistant" template="aitshopassist/assistant.phtml" before="category.products" />
</reference>
</catalog_category_view>
我在 cms_index_index 中尝试过,但没有用..
【问题讨论】:
-
getChildHtml方法将查看name值,即aitshopassist_assistant,而不是shop_assistant_block。这在catalog_category_view中如何正确显示?你能把你用来弹出它的布局更新粘贴到那里吗? -
我编辑问题,有布局的目录代码。谢谢