ModularMerchant
Knowledge Base
Shopping Cart Software Online Manual
Adding Reviews to a Product Template
Search Admin Attributes
Location Home > Shopping Cart Software Components > Administration Area > Modules > Product Reviews > FAQs & Tutorials

Adding Reviews to a Product Template

This tutorial demonstrates examples of both how add a review submission form to a product page in your storefront, and display a list of all the product's approved reviews.

These examples are intended for use in the product template. (File name: product.tpl). At this time, the QuickCode Tags below may not produce the expected results if used in other templates.

Displaying Reviews on a Product's Page in Your Store
This is a simple example of displaying a list of all of a product's approved reviews in your store. Edit the product template in your store, and add the following HTML and QuickCode Tags to the desired location. The way the reviews are displayed can be made more sophisticated using CSS, HTML tables, etc., but this example has been left simple just to demonstrate how the system works.

example
{IF-REVIEWS-BEGIN}

    <p>Sort reviews by {REVIEW-SORT-FIELD}</p>

    <p>Number of reviews: {NUMBER-OF-REVIEWS}<br />
    Average product rating: {REVIEW-COMPOSITE-RANK}</p>
      
    <p>------------------------------</p>
   
    {REVIEW-BLOCK-BEGIN}
   
       <p>Review by <b>{REVIEW-AUTHOR}</b> on {REVIEW-CREATE-DATE}</p>
          
       {IF-REVIEW-CRITERIA-BEGIN}
          <p>{REVIEW-AUTHOR} gave this product a score
          of <b>{REVIEW-AVERAGE-RANK}</b>.<br />
          Score details:<br />
          {REVIEW-CRITERIA-BLOCK-BEGIN}
             <b>{REVIEW-CRITERIA-RANK}</b>
             for {REVIEW-CRITERIA-NAME} ({REVIEW-CRITERIA-DESCRIPTION})<br />
          {REVIEW-CRITERIA-BLOCK-END}</p>   
       {IF-REVIEW-CRITERIA-END}   

       <p>{REVIEW-SUMMARY:150}{REVIEW-DETAIL}<br />
       {REVIEW-TOGGLE-DISPLAY-TAG}</p>

       <p>{REVIEW-VOTES-HELPFUL} of {REVIEW-VOTES-TOTAL} people
       have found this review helpful.<br />
       Did <b>you</b> find this review helpful?
       {IF-CUSTOMER-HAS-VOTED-ON-REVIEW-BEGIN}

                       You have already voted on this review.
                {ELSE}
                       <a href="{URL-REVIEW-VOTE-IS-HELPFUL}">YES</a> /
          <a href="{URL-REVIEW-VOTE-IS-UNHELPFUL}">NO</a></p>   
      
{IF-CUSTOMER-HAS-VOTED-ON-REVIEW-END}

       <p>------------------------------</p>
       
    {REVIEW-BLOCK-END}
   
{IF-REVIEWS-END}



The code example above would result in something that looks like this:
example
Sort reviews by

Number of reviews: 2
Average product rating: 7.5

------------------------------

Review by Dudley H. on 5/6/07

Dudley H. gave this product a score of 8.0.
Score details:
9 for Fuel Economy (Are you spending less at the pump?)
7 for Reliability (Have you lost touch with your mechanic?)
8 for Comfort (Could you stand a cross-country road trip?)

This vehicle was much better than I had expected! I didn't know that a solar powered car was capable of such long distances. My major complaint with it...
Show more.

275 of 311 people have found this review helpful.
Did you find this review helpful? YES / NO

------------------------------

Review by Loraine G. on 1/2/03

Loraine G. gave this product a score of 7.0.
Score details:
7 for Fuel Economy (Are you spending less at the pump?)
8 for Reliability (Have you lost touch with your mechanic?)
6 for Comfort (Could you stand a cross-country road trip?)

Surprising fuel economy, and I've never had problems with the vehicle. However, there isn't enough leg room in the back seats. My tall uncle suffered...
Show more.

104 of 188 people have found this review helpful.
Did you find this review helpful? YES / NO

------------------------------



Displaying the Review Submission Form
The HTML and QuickCode Tags below can be used to add a form to the product pages in the storefront that will allow logged in customers that have purchased a product to submit a review about it. Again, this example can be made more sophisticated using CSS, HTML tables, etc., but this example has been left simple just to demonstrate how the system works.

example
{IF-REVIEWER-AUTHORIZED-BEGIN}

    <form name="sample_review_form" method="post" action="{THIS-PAGE}">
    <p><b>Write a review:</b></p>
       
    {IF-REVIEW-CRITERIA-BEGIN}
       <p>Rank this product on the following criteria:<br />   
       {REVIEW-CRITERIA-BLOCK-BEGIN}
          {REVIEW-CRITERIA-FIELD}
          for {REVIEW-CRITERIA-NAME} ({REVIEW-CRITERIA-DESCRIPTION})<br />
       {REVIEW-CRITERIA-BLOCK-END}</p>   
    {IF-REVIEW-CRITERIA-END}
       
    <p><b>Write your review here:</b><br />
    {REVIEW-DETAILS-FIELD}</p>   
           
    <input type="submit" name="submit_review" value="Submit Review" />
    </form>

{ELSE}
    {IF-CUSTOMER-LOGGED-IN-BEGIN}

       Only users who have purchased this product may review it.
                Each customer may only review this product once.

    {ELSE}
       <p><form name="sample_login_form" method="post" action="{THIS-PAGE}">
       Only customers who have purchased this product may review it. Log in.<br />
       Email Address: <input type="text" name="login_email" size="30" /><br />
       Password: <input type="password" name="login_password" size="30" /><br />
       <input type="submit" name="cmr_login" value="Log in to your Customer Account" />
       </form></p>

    {IF-CUSTOMER-LOGGED-IN-END}

{IF-REVIEWER-AUTHORIZED-END}



The code example above would result in something that looks like this for customers who either aren't logged in or haven't purchased the product:
example
Only customers who have purchased this product may review it. Log in.
Email Address:

Password:     




Meanwhile, logged in customers that have purchased the product would see this:
example
Write a review:

Rank this product on the following criteria:
for Fuel Economy (Are you spending less at the pump?)
for Reliability (Have you lost touch with your mechanic?)
for Comfort (Could you stand a cross-country road trip?)

Write your review here:




— Last Edited - 04/12/2011 2:32pm PDT
Rank and add a comment to this article
Only logged in users may leave comments and rank articles. Log in to have your say!
  Knowledge Base Home

  QuickCode™ Tag Glossary

  Modular Merchant.com Homepage

Not Logged in.
Either Log in or create a User Account.

Other articles in this category...

Adding Reviews to a Product Template

Search Admin Attributes