[英]Magento - product reviews not showing on view.phtml
I'm trying to get the product reviews and form showing on the product view page (view.phtml) I've looked at some forum posts and tried: 我正在尝试在产品查看页面(view.phtml)上显示产品评论和表单,我查看了一些论坛帖子并尝试过:
Finding in catalog.xml 在catalog.xml中查找
<catalog_product_view translate="label">
And looking for the content: 并寻找内容:
<reference name="content">
In here I have entered the code: 在这里,我输入了代码:
<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/>
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_additional_data" template="review/product/view/list.phtml">
<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>
</block>
In view.phtml I have added 在view.phtml中,我已添加
<?php echo $this->getChildHtml('product_additional_data') ?>
<?php echo $this->getChildHtml('reviews') ?>
I get an empty are where this is suppose to show the review information. 我得到的是一个空白,应该在此处显示评论信息。 I have tabs working what I want to do it just show the review form and reviews in that tab.
我有一些选项卡可以满足我的需求,只需在该选项卡中显示评论表单和评论即可。
Any help is greatly appreciated. 任何帮助是极大的赞赏。
I'm not sure why it is but I had the same problem. 我不确定为什么会这样,但是我遇到了同样的问题。 It worked for me when I referenced the review form and reviews inside the product view part of the catalog.xml like this.
当我引用审阅表单并像这样在catalog.xml的产品视图部分中进行审阅时,它为我工作。
<block type="review/product_view_list" name="review.product_view_list" as="product_view_list" template="review/product/view/list.phtml"/>
<block type="review/form" name="product.review.form" as="review_form" />
I called them from view.phtml like this 我从view.phtml这样称呼他们
<?php echo $this->getChildHtml('review_form') ?>
<?php echo $this->getChildHtml('product_view_list') ?>
Hope it helps 希望能帮助到你
Edit local.xml 编辑local.xml
<catalog_product_view>
<reference name="content">
<block type="review/product_view_list" name="review.product_view_list" as="product_view_list" template="review/product/view/list.phtml"/>
<block type="review/form" name="product.review.form" as="review_form" />
</reference>
</catalog_product_view>
view.phtml view.phtml
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
<div class="box-collateral <?php echo "box-{$alias}"?>">
<?php if ($title = $this->getChildData($alias, 'title')):?>
<h2><?php echo $this->escapeHtml($title); ?></h2>
<?php endif;?>
<?php echo $html; ?>
</div>
<?php endforeach;?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.