我安装了一个扩展,它可以生成一个自动相关的产品块。不幸的是,出于某种原因,它想要创建自己的块,而不是替换本地块(从这个意义上讲,扩展似乎有些崩溃了?(
无论如何,在联系了他们的支持后,我没有得到任何回应,现在我不得不自己解决这个问题。
对我来说,第一步是将这个块包含在我们的catalog/product/view.phtml文件中。检查了扩展代码(布局文件(后,我可以看到以下内容:
<block type="autorelatedproduct/autorelatedproduct" name="autorelatedproduct" template="autorelatedproduct/autorelatedproduct.phtml" />
将其包含在产品视图中内容下的catalog.xml文件中,然后尝试通过模板调用此块。我没有什么新鲜事。
有人能帮我吗?告诉我如何将这个块包含在我的模板中?
一如既往,任何帮助都会得到我们的感激!
您可以像一样在local.xml中调用它
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_product_view>
<reference name="content">
<block type="autorelatedproduct/autorelatedproduct" name="autorelatedproduct" template="autorelatedproduct/autorelatedproduct.phtml" />
</reference>
</catalog_product_view>
</layout>
如果你想把它放在特定的位置,你可以试试
<reference name="product.info">
并在view.phtml中调用它getChildHtml('yourblock'(;
<catalog_product_view translate="label">
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="autorelatedproduct/autorelatedproduct" name="autorelatedproduct" template="autorelatedproduct/autorelatedproduct.phtml" />
</block>
</catalog_product_view>
并使用echo$this->getChildHtml("autorelatedproduct"(调用它;在视图中.html