簡體   English   中英

Magento:通過XML在list.phtml中調用自定義phtml

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

在Magento中,我試圖在list.phtml中顯示一個phtml自定義模塊。 我的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>

我這樣叫: <?php echo $this->getChildHtml('prevenda') ?>

但是此方法只能在view.phtml中進行。 如何顯示在list.phtml中? 將保留產品名稱

我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