更新时间:2023-11-30 15:56:40
不需要在代码中添加块,应该使用配置XML文件来完成.
There's no need to add the block in code, it should be done using config XML files.
为您的模块创建XML配置(有关此主题的大量教程).
Create an XML config for your module (plenty of tutorials on this).
检查catalog.xml(应用/设计/前端/基本/默认/布局/)
check catalog.xml (app/design/frontend/base/default/layout/)
<catalog_product_view translate="label">
....
</catalog_product_view>
在此处设置块以在产品视图页面上显示.您可以使用自己的模块XML文件对此进行修改,如下所示:
This is where the blocks are setup for display on the product view page. You can modify this using your own modules XML file, something like this:
<catalog_product_view translate="label">
<reference name="content">
<block type="compatiblewith/compatible" name="my.block" template="compatiblewith/compatible/template.phtml" />
</reference>
</catalog_product_view>
这将在内容区域内的产品视图页面上显示您的自定义块.
this will show your custom block on the product view page, inside the content area.
如果将其命名为Compatible.php,您的块命名也将出错,该类应为SmartGrowth_CompatibleWith_Block_Compatible