由 rondo » 2011-01-18 22:37
谢谢楼主,我在zencartV1.3.9h上试过了,前后台都能正常显示回复的评论,不要改第三个文件,那是没影响的,如果想在产品详细页上显示评论及回复:找到\includes\templates\Yourtemplate\templates\tpl_product_info_display.php,在合适的地方加入如下的代码(改之前先备份你的文件):
<?php
if ($reviews_split->number_of_rows > 0) {
if ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')) {
?>
<h2 id="productReviewsDefaultHeading"><?php echo TEXT_REVIEW_TITLE; ?></h2>
<div id="productReviewsDefaultListingTopNumber" class="navSplitPagesResult"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></div>
<div id="productReviewsDefaultListingTopLinks" class="navSplitPagesLinks"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'main_page'))); ?></div>
<?php
}
foreach ($reviewsArray as $reviews) {
?>
<hr />
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . (int)$_GET['products_id'] . '&reviews_id=' . $reviews['id']) . '">' . zen_image_button(BUTTON_IMAGE_READ_REVIEWS , BUTTON_READ_REVIEWS_ALT) . '</a>'; ?></div>
<div class="rating"><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $reviews['reviewsRating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviewsRating'])),sprintf(TEXT_OF_5_STARS, $reviews['reviewsRating']); ?></div>
<div class="productReviewsDefaultReviewer bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($reviews['dateAdded'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($reviews['customersName'])); ?></div>
<div class="productReviewsDefaultProductMainContent content" style="width:600px"><?php echo zen_break_string(zen_output_string_protected(stripslashes($reviews['reviewsText'])), 70, '<br />') . ((strlen($reviews['reviewsText']) >= 100) ? '...' : ''); ?></div>
<br>
<?php if($reviews['reviewsReply'] != null){?>
<div style="width:600px>Reply:
<?php echo zen_break_string(zen_output_string_protected(stripslashes($reviews['reviewsReply'])), 70, '<br />'); ?>
</div>
<?php }?>
<br class="clearBoth" />
<?php
}
?>
<?php
} else {
?>
<hr />
<div id="productReviewsDefaultNoReviews" class="content"><?php echo TEXT_NO_REVIEWS . (REVIEWS_APPROVAL == '1' ? '<br />' . TEXT_APPROVAL_REQUIRED: ''); ?></div>
<br class="clearBoth" />
<?php
}
if (($reviews_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
<hr />
<div id="productReviewsDefaultListingBottomNumber" class="navSplitPagesResult"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></div>
<div id="productReviewsDefaultListingBottomLinks" class="navSplitPagesLinks"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'main_page'))); ?></div>
<?php
}
?>
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array('reviews_id'))) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
正如楼主说的那样,不同版本不可照搬照抄,在zencartV1.3.9h上数据库表reviews没有customer_email和customer_ip字段,所以在修改header_php.php时不必加它们进去。