magento -- 怎么把评论显示到产品页面
2012-04-01 17:17
597 查看
magento -- 怎么把评论显示到产品页面 Magento默认的评论填写和显示都是需要从产品页点击到另一个页面,怎么把提交评论的表单和评论的显示都拿到产品页来也算是一个古老的问题了,相信很多人都知道怎么操作了,不过也还是经常有刚接触Magento的人提到这个问题,今天就描述下流程(以1.4.1.1为例)。
打开/app/design/frontend/default/your_theme/layout/review.xml,复制如下代码
[xhtml] view plaincopyprint?
<block type="page/html_pager" name="product_review_list.toolbar" />
<block type="core/template" name="product_review_list.count" template="review/product/view/count.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">
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
</block>
打开/app/design/frontend/default/your_theme/layout/catalog.xml,找到
<!--
Product view
-->
粘贴刚才复制的代码到
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
这个Block内部,因为product_additional_data这个Block名在产品页已经被使用,所以为了避免冲突我把评论这个Block的as改为product_review
[xhtml] view plaincopyprint?
<block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
<label>Bottom Block Options Wrapper</label>
<action method="insert"><block>product.tierprices</block></action>
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
<action method="append"><block>product.info.addtocart</block></action>
</block>
<!--Alex -->
<block type="page/html_pager" name="product_review_list.toolbar" />
<block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" 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">
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
</block>
<!--Alex -->
<block type="core/template_facade" name="product.info.container1" as="container1">
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
<action method="append"><block>product.info.options.wrapper</block></action>
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
</block>
最后一步,打开/app/design/frontend/default/your_theme/template/catalog/product/view.phtml,在适当的位置调用刚才的Block,我现在把它加到最后面
[xhtml] view plaincopyprint?
<?php echo $this->getChildHtml('upsell_products') ?>
<?php echo $this->getChildHtml('product_additional_data') ?>
<!--Alex -->
<?php echo $this->getChildHtml('product_review') ?>
<!--Alex -->
完成,缓存开着的话记得要刷新下缓存。效果如下
打开/app/design/frontend/default/your_theme/layout/review.xml,复制如下代码
[xhtml] view plaincopyprint?
<block type="page/html_pager" name="product_review_list.toolbar" />
<block type="core/template" name="product_review_list.count" template="review/product/view/count.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">
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
</block>
打开/app/design/frontend/default/your_theme/layout/catalog.xml,找到
<!--
Product view
-->
粘贴刚才复制的代码到
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
这个Block内部,因为product_additional_data这个Block名在产品页已经被使用,所以为了避免冲突我把评论这个Block的as改为product_review
[xhtml] view plaincopyprint?
<block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
<label>Bottom Block Options Wrapper</label>
<action method="insert"><block>product.tierprices</block></action>
<block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
<action method="append"><block>product.info.addtocart</block></action>
</block>
<!--Alex -->
<block type="page/html_pager" name="product_review_list.toolbar" />
<block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" 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">
<action method="setMayBeInvisible"><value>1</value></action>
</block>
</block>
</block>
<!--Alex -->
<block type="core/template_facade" name="product.info.container1" as="container1">
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
<action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
<action method="append"><block>product.info.options.wrapper</block></action>
<action method="append"><block>product.info.options.wrapper.bottom</block></action>
</block>
最后一步,打开/app/design/frontend/default/your_theme/template/catalog/product/view.phtml,在适当的位置调用刚才的Block,我现在把它加到最后面
[xhtml] view plaincopyprint?
<?php echo $this->getChildHtml('upsell_products') ?>
<?php echo $this->getChildHtml('product_additional_data') ?>
<!--Alex -->
<?php echo $this->getChildHtml('product_review') ?>
<!--Alex -->
完成,缓存开着的话记得要刷新下缓存。效果如下
相关文章推荐
- magento -- 怎么把评论显示到产品页面
- 让magento的评论显示在产品页面
- 在 magento产品页面显示评论表单(review form)
- Magento产品页面显示评论
- Magento后台订单页面显示产品url地址
- magento 产品页显示评论并分页
- magento 产品评论模块的显示
- magento产品页面显示最低运费
- 解决 ECSHOP v273 产品详情页面评论不显示的问题
- Magento网站分类页面显示子分类而不是产品的方法
- magento发布评论显示问题
- magento 后台订单显示产品小图片
- 项目组给了我一个接口直接访问是json的数据,我怎么在得到接口中的json数据在页面显示啊!
- Magento首页(子页)显示特价产品
- 产品编辑页面 使联动的DropDownList1 DropDownList2显示原来显示的值
- 常见magento问题系列四-----后台的分类页面不正常显示
- Magento前台只有产品的缩略图不显示?
- Magento中显示产品折扣百分比
- 在jsp页面上怎么按照文字原本的 格式显示
- 如何在静态页面上显示评论数