简体   繁体   English

Magento模块自定义模块在产品详细信息页面中有效,但在列表和网格页面中无效?

[英]Magento module custom block working in product details page but not working in list and grid page?

In magento I am writing one module. magento中,我正在编写一个模块。 In my module lets say I have mymodule.xml where I want to insert my own block after this block 在我的模块中,可以说我有mymodule.xml ,我想在此块之后插入自己的块

<catalog_product_view>
    <reference name="product.info">
      <block type="test/test" name="test" as="other" template="test/test.phtml" >
        <block type="test/test" name="test_info" as="test_info" template="test/testinfo.phtml" />
      </block>
    </reference>
  </catalog_product_view>

This one is working fine in product details view page but when I am trying to show the same block in product category view and list view its not working at all. 这在product details view page运行良好,但是当我尝试在product category view and list view显示相同的块时,它根本无法工作。 The product list category is like this where I am inserting my code from mymodule.xml 产品列表类别是这样的,我从mymodule.xml插入代码

    <catalog_product_list>
    <reference name="product.info">
       <block type="test/test" name="test" as="other" template="test/test.phtml" >
        <block type="test/test" name="test_info" as="test_info" template="test/testinfo.phtml" />
      </block>
    </reference>
  </catalog_product_list>

When I am going to check the changes in list view I can't see any changes (after clearing cache). 当我要检查列表视图中的更改时,我看不到任何更改(清除缓存后)。 So can someone kindly tell me how to solve this issue. 所以有人可以告诉我如何解决这个问题。 Any help and suggestions wll be really appreciable. 任何帮助和建议将是非常可观的。 Thanks.. 谢谢..

Well, The xml code which you are using in the category page ( list page) is not correct. 好吧,您在类别页面(列表页面)中使用的xml代码不正确。 It should be like this : 应该是这样的:

<catalog_category_default>
<reference name="category.products">
    <block type="test/test" name="test" as="other" template="test/test.phtml" >
        <block type="test/test" name="test_info" as="test_info" template="test/testinfo.phtml" />
    </block>
</reference></catalog_category_default>

<catalog_category_layered>
<reference name="category.products">
   <block type="test/test" name="test" as="other" template="test/test.phtml" >
    <block type="test/test" name="test_info" as="test_info" template="test/testinfo.phtml" />
  </block>
</reference>  </catalog_category_layered>

Please try with that. 请尝试一下。 And, if anything else, please contact me. 并且,如果还有其他问题,请与我联系。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM