Jump to content
mrscripto

Custom text - graphic for editor ratings

Recommended Posts

mrscripto

I wanted to add a graphic with score, and custom text (based on the score) to my editor reviews to make them stand out more. Based on direction from Alejandro, here is the code and a screen shot.

 

Copy themes/default/detailed_ratings.thtml to your custom theme folder and rename to detailed_editor_ratings.thtml

 

Edit detailed_editor_ratings.thtml, and depending on if your site uses single or multiple criteria, you will have to add this code directly under either this line:

<?php if(count($review['Criteria']['criteria']) == 1): // Only one criterion defined ?>

 

or this line:

 

<?php elseif($showDetailedCriteriaRatings): // More than one criterion, display detailed ratings ?>

 

This is the code to add:

<tr valign="bottom"> 
	<td colspan="3" style="background-image:url('http://www.your-website.com/images/some-image.png'); background-repeat:no-repeat; background-position:top center;">
<div align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:40px; font-weight:bold; margin-top: 30px; margin-bottom: 5px;">
<?php echo $Rating->round($review['Rating']['average_rating'],$this->Config->rating_scale);?></div>
<div align="center" style="font-family:Georgia, serif; font-size:14px; color:#225769; font-weight:bold;">
  <?php 
  $tqrating = $Rating->round($review['Rating']['average_rating'],$this->Config->rating_scale);
  if ($tqrating >= 95) {
  echo 'Outstanding,<br>a must have!';
  } elseif ($tqrating < 95 && $tqrating > 89) {
  echo 'Excellent,<br>highly recommended!';
  } elseif ($tqrating < 90 && $tqrating > 84) {
  echo 'Very Good,<br>recommended.';
  } elseif ($tqrating < 85 && $tqrating > 79) {
  echo 'Good';
  } elseif ($tqrating < 80 && $tqrating > 74) {
  echo 'Above Average';
  } ?>
  </div></td>
  </tr>

 

The image I was using for the background was 90px by 60px, customize for your site. And my ratings are based on a score to 100, so you can modify the numbers and text above to match your site.

 

You also need to edit your /themes/default (or custom)/listings/detail.thtml template. There are 3 occurrences of detailed_ratings, search for that text and replace the first 2 with detailed_editor_ratings. In the BEGIN EDITOR REVIEWS and SINGLE EDITOR REVIEW sections.

 

Cheers!

post-505-1424298827771_thumb.png

Share this post


Link to post
Leon

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Leon

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Dominik Beniamin Szabo

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Alejandro

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Mike b

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Mike b

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Alejandro

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Mike b

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Mike b

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Alejandro

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Mike b

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
bryan choo

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Alejandro

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
bryan choo

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
mrscripto

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Kristian

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post
Giorgi Todua

This section is only visible with a valid subscription. If you have a valid subscription, please login.

Share this post


Link to post

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Please refer to our Privacy Policy.