简体   繁体   English

Magento:通过XML在list.phtml中调用自定义phtml

[英]Magento: Call custom phtml in list.phtml via XML

In Magento, I'm trying to show a phtml a custom module in list.phtml. 在Magento中,我试图在list.phtml中显示一个phtml自定义模块。 My xml looks like this: 我的xml看起来像这样:

<catalog_category_default>
    <reference name="content">
            <block type="my_prevenda/prevendalist" name="prevenda" as="prevenda" template="prevenda/prevenda_list.phtml" />
    </reference>
</catalog_category_default>

And I call like this: <?php echo $this->getChildHtml('prevenda') ?> 我这样叫: <?php echo $this->getChildHtml('prevenda') ?>

But this method only shou in view.phtml. 但是此方法只能在view.phtml中进行。 How do I appear in list.phtml? 如何显示在list.phtml中? Will remain with the product name 将保留产品名称

I Tks all!! 我Tks所有!

<?xml version="1.0"?>
<layout>
    <catalog_category_default>
        <reference name="product_list"><!-- need to add to the correct parent block -->
                <block type="my_prevenda/prevendalist"
                       name="prevenda" as="prevenda"
                       template="prevenda/prevenda_list.phtml" />
        </reference>
    </catalog_category_default>
</layout>

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

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