Magento-在产品查看页面上显示产品评论 [英] Magento - display product reviews on product view page

查看:82
本文介绍了Magento-在产品查看页面上显示产品评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难将产品评论放在特定位置的主产品视图上.我可以将它们加载到内容区域中,但不能加载到所需的特定位置(在某些视图标记中).

I am having difficulty placing the product reviews on the main product view at a specific location. I can load them in the content area, but not at the specific location I require (within some of the view mark-up).

我有一个local.xml,其中包含以下内容:

I have a local.xml with the following in it:

<catalog_product_view>
    <reference name="content"> 
         <block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/>
    </reference>
<catalog_product_view>

由于内容不是模板块,因此上述内容会在所有其他内容之后加载评论.

The above loads the reviews after all other content - as might be expected, due to content not being a templated block.

我尝试在内容引用之外定义块,并将其放置在相关位置:

I have tried defining the blocks outside of the content reference, and placing this at the relevant point:

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

为清楚起见,这是我需要在view.phtml中出现该块的地方:

For clarity, here is where I need the block to appear in view.phtml:

<div class="product-collateral">
<?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;?>
    <?php echo $this->getChildHtml('upsell_products') ?>
    <?php echo $this->getChildHtml('product_additional_data') ?>
    <?php echo $this->getChildHtml('reviews') ?>
</div>

不幸的是,这根本不输出任何东西.我是Magento的新手,但我不知该如何实现上述目标.

Unfortunately, this doesn't output anything at all. I'm fairly new to Magento, and I'm at a loss how to achieve the above.

推荐答案

您可以尝试像示例中那样保留代码,并在该属性之前或之后包含和使用该属性. 这样,您可以相对于该参考中的另一个块来定位一个块.

You can try leaving the code as in your example and include and use the attribute before, or after. This allows you to position a block in regards to another block within that reference.

例如:<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml" before="product.description"/>

这篇关于Magento-在产品查看页面上显示产品评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆