开发者

Magento layouts and templates using getChildHtml()

I have looked quite a few Magento references, but still struggling to materialize how to solve this problem.

<layout version="0.1.0">
    <catalog_product_view translate="label">
        <reference name="product.info.addtocart">
                      <action method="setTemplate">
                          <template>ash_ajacart/catalog/product/view/addtocart.phtml</template>
                      &开发者_JAVA技巧lt;/action>
                      <block type="ajacart/product_view" name="wow" as="wow" template="ash_ajacart/ajacart-js.phtml" />
        </reference>
    </catalog_product_view>
</layout>

Is my layout XML file. The template "addtocart.phtml" renders fine. But when I call <?php echo $this->getChildHtml('wow') ?> inside of that template it doesn't call the "ajacart-js.phtml" template. I don't know if I am structuring everything wrong in the XML file, but it seems right to me.


When you use <block type="ajacart/product_view" name="wow" as="wow" template="ash_ajacart/ajacart-js.phtml" /> you must have a block class that matches ajacart/product_view. If not, the simplest way to get the template to show is change the type to core/template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜