在商品产品页面进行修改的时候,我们都想把产品评论显示在产品当前页面上,其实无论对于SEO还是对于产品销售来说,显示产品评论好处还是很大的。
我们进行讲解下怎么修改
1.在文件includes\templates\template_default\templates\tpl_product_reviews_default.php 复制文件tpl_product_reviews_default.php到当前网站使用模板templets下。把文件tpl_product_reviews_default.php命名为tpl_modules_product_reviews.php,打开tpl_modules_product_reviews.php文件,里面一些不需要的代码你可以自行去除。
2.在你模板templates文件夹下找到tpl_product_info_display.php,打开文件在相应位置放入下面代码:
[php]
<?php
/**
* display the product reviews info
*/
require($template->get_template_dir(‘/tpl_modules_product_reviews.php’,DIR_WS_TEMPLATE, $current_page_base,’templates’). ‘/tpl_modules_product_reviews.php’); ?>
[/php]
3.在includes\modules\pages\product_reviews\header_php.php找到下面代码并复制
[php]
$review_status = " and r.status = 1";
$reviews_query_raw = "SELECT r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, r.customers_name
FROM " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd
WHERE r.products_id = :productsID
AND r.reviews_id = rd.reviews_id
AND rd.languages_id = :languagesID " . $review_status . "
ORDER BY r.reviews_id desc";
$reviews_query_raw = $db->bindVars($reviews_query_raw, ‘:productsID’, $_GET[‘products_id’], ‘integer’);
$reviews_query_raw = $db->bindVars($reviews_query_raw, ‘:languagesID’, $_SESSION[‘languages_id’], ‘integer’);
$reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
$reviews = $db->Execute($reviews_split->sql_query);
$reviewsArray = array();
while (!$reviews->EOF) {
$reviewsArray[] = array(‘id’=>$reviews->fields[‘reviews_id’],
‘customersName’=>$reviews->fields[‘customers_name’],
‘dateAdded’=>$reviews->fields[‘date_added’],
‘reviewsText’=>$reviews->fields[‘reviews_text’],
‘reviewsRating’=>$reviews->fields[‘reviews_rating’]);
$reviews->MoveNext();
}[/php]
在includes\modules\pages\product_info\header_php.php文件中找到下面代码。
[php]
// This should be last line of the script:
$zco_notifier->notify(‘NOTIFY_HEADER_END_PRODUCT_INFO’);
[/php]
将前面product_reviews\header_php.php复制的代码复制到这段代码上面上面。
4. 在includes\languages\english\当前使用模板\product_info.php文件种最后面加入下面代码
[php]
//bof product reviews
define(‘TEXT_OF_5_STARS’, ‘%s of 5 Stars’);
define(‘TEXT_APPROVAL_REQUIRED’, ‘NOTE: Reviews require prior approval before they will be displayed’);
//eof product reviews
[/php]
下面效果图
发表评论