简体   繁体   中英

Magento: Call custom phtml in list.phtml via XML

In Magento, I'm trying to show a phtml a custom module in list.phtml. My xml looks like this:

<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') ?>

But this method only shou in view.phtml. How do I appear in list.phtml? Will remain with the product name

I Tks all!!

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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