Magento getChildHtml块无法渲染

时间:2014-05-06 17:59:14

标签: magento

我试图重新排列网页上的某些元素,而我的代码却无法将其呈现为新的位置。

页面顶部在view.phtml中处理,在list.phtml中处于底部。我想将form.phtml从视图移动到列表。

xml看起来像这样:

     <block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
            <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
                <action method="disableGallery"/>
            </block>
            <block type="review/form" name="product.review.form" as="review_form" template="review/form.phtml"/>

view.phtml包含此调用:

     <?php echo $this->getChildHtml('review_form') ?>

然而,没有骰子。我对Magento很新,所以任何帮助都会很棒。我已经查看了以下问题以及更多但没有结果的问题:

Nested block within a reference not rendering when using ->getChildHtml()

Magento $this->getChildHtml('media') return blank

Call magento template via $this->getChildHtml()

谢谢!

1 个答案:

答案 0 :(得分:0)

根据您的描述,查看子块是在视图中调用然后...

应该是

     <block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
                <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
                    <action method="disableGallery"/>
                </block>
                <block type="review/form" name="product.review.form" as="review_form">
                        <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
                            <label>Review Form Fields Before</label>
                            <action method="setMayBeInvisible"><value>1</value></action>
                        </block>
                    </block>
.........