Business, Tech, Life, and Whatever else

Rating Module

by Eric Barnes on February 11, 2009

68 Classifieds Rating Module

The rating module allows users to review listings or members.

Instructions

Upload the rating folder to your modules directory and then visit administration -> settings -> modules and activate it.

Member Rating

For member rating add the following code in your member.tpl file

{assign var="rating" value=$smarty.const.FILESYSTEM_PATH}{include file="$rating/modules/rating/templates/member_rating.tpl"}

Listing Rating

For listing rating add the following code in your viewlistings.tpl file

{assign var="rating" value=$smarty.const.FILESYSTEM_PATH}{include file="$rating/modules/rating/templates/listing_rating.tpl"}

Restrict to Registered Users

If you would like to restrict reviews to only registered users you could open the template file rating.tpl and add this:

{if $smarty.session.username<>""}{$smarty.const.LANG_WRITE_REVIEW}{else}Please login to add a review.{/if}

Change Log

  • v1.7 – August 13, 2009
  • v1.6 – June 9, 2009
  • v1.5 – April 8, 2009
  • v1.4 – April 1, 2009

Help & Support

This is a free plugin and I make absolutely no guarantee I can offer support. If you find any bugs please report it to the Issue Tracker.

Download

Download | SVN | Donate

You May Also Be Interested In...

Building a news module – 68 Classifieds
July 1, 2009

68 Classifieds – The Power of Includes
July 2, 2009

Gravatar Plugin
December 21, 2008

Project – Suzuki Kawasaki of Gastonia
June 24, 2009

Subscribe Now

If you enjoyed this post, you will definitely enjoy my others. Subscribe to the feed to get instantly updated for those awesome posts soon to come.


  • Peter
    How do i add {$rev.star} to this? {foreach from=$reviews item="rev"}

    Is it like this? {foreach from=$reviews item="{$rev.star}"}

    Please show me how the finished code looks!
  • ibay
    I am trying to exclude the listing owners rating from the overall score. to sum the total score, I tries to modify the sql query to:
    $sSQL="SELECT SUM(score) AS totalscores FROM ".PREFIX."rating WHERE uid=".$member." AND approved='Y' AND person<>".$username."";

    this is to exclude the score submitted by the member himself... but this query does not return any results... what's wrong?

    then, how do I get the total number of reviews (excluding the reviews submitted by the member himself).. now it's using the $rows variable which is the total number of reviews including those submitted by the member.

    I just want to exclude the members own score from the average score.
  • Looks like you have your quotes wrong around username variable.
  • ibay
    got the Manual Approval issue to work... modified the hook.php and included approved="Y" in the SQL query.
  • ibay
    i have set Manual Approval to YES... but still the reviews are displayed as soon as a user submits them. how do I set to Manual Approval?
  • ibay
    how do I resize the add-review windows?
  • No not currently. You would have to manually check them and delete them if the same user added it twice.
  • guillo
    is there a way to restrict the module to be used ONCE by any registered user.
  • guillo
    im sorry, that is what I used.
  • guillo
    i was able to place the stars on the individual user ratings but not on the average ratings.

    I tested placing {$rev.star} in every other place of the template with no success.

    Please advice. Thanks!
  • For the total average you need to use this variable: {$star}
  • guillo
    also, im not sure if i missed it in the above comments but is it possible to show images of stars instead of text?
  • Inside the {foreach from=$reviews item="rev"} just add:
    {$rev.star}

    This will show the images for the individual review.

    If you want to show the images for the average total reviews then you can use: {$star} That does not have to be inside the foreach loop.
  • guillo
    Where in the template am I supposed to add the code to restrict to registered users only.

    {if $smarty.session.username<>""}{$smarty.const.LANG_WRITE_REVIEW}{else}Please login to add a review.{/if}
  • ibay
    i got the above figured out..
    how can I make the $star variable available in the viewlisting2.tpl page for that I can show the user rating on that page.
  • The {$star} variable only pulls out the rating the listing on viewlisting or viewlisting2 template pages.

    If you want to show it they you add it to the template just as I did above: {$star}
  • ibay
    i would like to restrict rating for registered users only.... is it possible to make the Name field equal to the logged-in user's username ..... and do not allow user to enter a different name..
  • Hi Eric - This plugin seems to be working fine so far but I am not seeing a rating.tpl file anywhere on my server. I tried putting the code you provided for that page into listing_rating.tpl but it only has text saying you need to login - doesn't actually require it. Am I missing something?
  • You should be placing the code above in either viewlisting.tpl or member.tpl. The rating template is part of the module download but named listing_rating.tpl or member_rating.tpl
  • If you submit a rating and it shows 5 out of 10 stars then you will need to edit your main 68 Classifieds language/english.php and search for LANG_OUT_OF_STARS. Then change it to out of 5.
blog comments powered by Disqus