Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / how to show customer’s review in product’s info page?

how to show customer’s review in product’s info page?

Started by sunrise99 on 6 Jul 2015, 12:17 AM · Views: 820

Results 1 to 1 of 1
6 Jul 2015, 12:17 AM
#1
sunrise99 avatar

sunrise99

New Zenner

Join Date:
Apr 2008
Posts:
41
Plugin Contributions:
3

Post #1 by sunrise99

For the seo purpose,i need to show all product’s review in the product info page.so the product info page will be updated when customer add new review on the product.Google like the website which updates its content regularly.

By default,zen cart show customer’s review on the product review page,so i think this would not be a difficult thing to be done.All i need to do is copy and paste.Well,it’s easy,but it’s not so easy to be done.You may know that any page in zen cart is defined by at least three parts,the language file,the template file and the module file,the one usually located in zen_cart_site_root/includes/modules/pages/[page_name]/ folder.

so first i include the language file in the product info page as below:

<?php //require the language file of product reviews page require_once($language_page_directory .'product_reviews.php'); ?>

then,copy template part:

<?php foreach ($reviewsArray as $reviews) { ?> <hr /> <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="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="productReviewsDefaultProductMainContent content"><?php echo zen_break_string(zen_output_string_protected(stripslashes($reviews['reviewsText'])), 60, '-<br />') . ((strlen($reviews['reviewsText']) >= 100) ? '...' : ''); ?></div> <div class="clear"></div> <?php } ?>

third,i copy the product_review module file,which get the review data from database

cd includes/modules/pages
cp product_reviews/header_php.php product_info/header_php_review.php
Ok.now refresh the prodcut info page,it will show product review if any existed.

we provide professional template with the lowest price for you.
https://www.sunrisebook.com