This article introducesHow to display magento user comments to the product details page: Magento1.4.1.1 is used as an example.
Open/APP/design/frontend/default/your_theme/layout/review. xml and copy the following code:
<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>
Open/APP/design/frontend/default/your_theme/layout/CATALOG. xml and find
<! -
Product View
->
Paste the copied code
<Block type = "catalog/product_view" name = "product.info" template = "catalog/product/view. phtml">
Because the block name product_additional_data has been used on the product pageChange the as comment on this block to product_review.
<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>
<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>
<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>
In the last step, open/APP/design/frontend/default/your_theme/template/CATALOG/product/view. phtml: Call the block at the right position. I will add it to the end.
<? PHP echo $ this-> getchildhtml ('upsell _ products')?>
<? PHP echo $ this-> getchildhtml ('product _ additional_data ')?>
<? PHP echo $ this-> getchildhtml ('product _ review')?>
Magento comments are displayed on the product details page.As shown in the following figure:
Magento comments