首先,我想说的是,我整天都在互联网上进行搜索,但是找不到我想要的东西。我也是这里的新手,因此,如果我违反任何规则,请原谅我。
我正在尝试开发一个模块,该模块会将视频以及图像添加到产品页面。我陷入了这个观念:
如何将我的块插入现有的基本块中?例如,在产品页面中,有一个空白product.info。在此块内有“可用性”,“价格”等。如何使用模块的布局xml和模板在“可用性”下方和“价格”上方插入我的自定义块。
因此,我正在尝试使用模块的布局文件来实现以下目的:
<catalog_product_view translate="label">
<reference name="content">
<reference name="product.info">
WRITE BLOCK HERE SO THAT MY BLOCK SHOWS BELOW AVAILABLITY
</reference>
</reference>
</catalog_product_view>
这可能吗 ?还是我必须重写核心类Mage_Catalog_Block_Product_View来执行此操作?
PS:基本上,我的目标是在图像旁边列出我的视频。现在,我可以从模块中列出我的视频,但是在这种情况下,图像不可用。我用了
<block type="myblock/myblock" name="somename" as="media" template="abc.phtml"/>
因此,我想将块附加到现有内容中。
我解决了 我不得不重写Mage_Catalog_Block_Product_View_Media。
在我的课堂上,我重写了_toHtml函数,如下所示:
public function _toHtml()
{
$html = parent::_toHtml();
$html.=$this->getChildHtml('media_video');
return $html;
}
其中“ media_video”是我的阻止对象。我的布局xml文件:
<catalog_product_view translate="label">
<reference name="content">
<reference name="product.info">
<reference name="product.info.media">
<block type="myblock/myblock" name="somename" as="media_video" template="beta/abc.phtml"
before="-"/>
</reference>
</reference>
</reference>
</catalog_product_view>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句