CREATE A 10 STAR RATING SYSTEM IN CMSB - Dec 29th, 2018
|
It’s become quite common for hotels, attractions and other listings to include both reviews and star rating systems in their listings.
Here’s how to create a star rating system for your site, using CMSB. It’s here courtesy of CMSB user thenetgirl, who created it for a rental property client.
EDITORS First, you’ll need to create 2 multi-record editors. They’re called “Vacation Rentals” and “Ratings”.
* You can create preformatted editors by upload the ,ini.php files in the download package below to your cmsAdmin/data/schemaPresets folder and then creating the editors from the "select presets" pulldown menu
The Vacation Rentals editor contains the listing information records for the individual properties.
(Each record contains listing information for a single property. The “Property Code” field value in the “Vacation Rentals” editor is used in a pull down list to populate the “Property Code” field in the “Ratings” editor. )
The Ratings editor contains the customer submitted ratings for the individual properties. (There can be multiple “Ratings” records for the same property. The “votes” are averaged and displayed in the appropriate viewers. The VacationRentalsDetail viewer shows only the overall rating for the property and the MoreRatings viewer shows detailed ratings for that property.
VIEWERS There are 3 viewers that you’ll need to create: VacationRentalsList.php, VacationRentalsDetail.php, and MoreRatings.php.
The Vacation Rentals viewers are standard list and detail pages for the property listings. Code to display the "Overall Rating" and a link to the MoreRatings detailed ratings viewer are added to the VacationRentalsDetail page
The MoreRatings viewer is the one that shows the average of the ratings submitted for the particular property. Code to display the detailed ratings is added to this viewer.
IMAGES You’ll also have to create the “star” images to be displayed as the ratings. I’ve created some simple circle gifs with the numbers 1-9 for this demonstration. (They are hard coded to be found in an images/stars folder in the directory that contains your viewer files, so if you change the location, don’t forget to change the viewer coding.)
Rather the listing all the code here, you can download the ini.php* files the sample viewer files, and a folder containing the 9 sample star gifs from:
http://thecmsbcookbook.com/downloads/ratings.zip
** DON’T FORGET TO CHANGE THE "LOAD VIEWER LIBRARY - $dirsToCheck" PATH IN THE SAMPLE VIEWERS TO YOUR OWN SERVER PATH.
Before you can see the rating system in operation, you’ll need to create some “property listings” records in the Vacation Rentals editor and then some Ratings records for those properties in the Ratings editor.
Once you’ve created a working system, you can customize the components for your specific needs.
You can also use the membership plugin to allow previously registered guests to post their own ratings and comments.
|
The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact
Interactive Tools for information on the downloading of the software or the purchasing of licenses.