【问题标题】:how to add custom block before product tag on product view page in layout xml in magento?如何在magento布局xml的产品视图页面上的产品标签之前添加自定义块?
【发布时间】:2015-01-13 13:01:24
【问题描述】:

我想在 magento 的产品视图页面上的产品标签之前或产品描述之后添加我的自定义块。我使用了下面的代码,但它不起作用:

<catalog_product_view>
    <reference name="content">
        <block type="module/block" after="product.description"
          name="example_block" template="module/example.phtml"/>
    </reference>
</catalog_product_view>

【问题讨论】:

    标签: xml magento layout block product


    【解决方案1】:

    我想你在这里漏掉了一些东西。

    通过使用上面的代码,它不会在产品视图页面内添加块。往下看

     <reference name="content">
                <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml"> 
    

    请注意,您是在“catalog/product_view”块之外添加的。我认为这是您的问题。现在,对于解决方案,您需要在“catalog/product_view”块中添加您的块。我认为将catalog.xml文件覆盖到您的主题并添加应该可以,但是如果您想从另一个添加它布局文件比看看下面的链接

    Add some block to product view page through module xml file Magento

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-18
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多