Hotel Rating System

Permalink 1 user found helpful
Hi

I am building a website that contains holiday tours and related hotels.
I want a system that allows me to assign a rating to each hotel (eg. 5 star, 2 star and also 1/2 stars, so 4.5 stars). This is not an accumulated rating, but a specific rating as designated by the editor of the website.

Is it possible to use the rating attribute to allow for the editor to select 1/2 values in any way?

Or has anyone managed to create a custom rating attribute that allows for 1/2 values.

As an additional piece of information, I am looking at using the ecommerce package to create the holiday tours in. Its easy enough to relate a "star" value to the holiday tour, but only in whole units.

kind regards

servondesign
 
mesuva replied on at Permalink Reply
mesuva
You could probably knock this up in about 5-10 mins using a custom select attribute. All the select would need is the list of options, and you could simply use the value to output your different stars etc.

On your page lists block templates, page templates (or for eCommerce the product list and product block templates), you'd just fetch the attribute value and either do your own bit of logic to output the stars, or you could perhaps try utilising the ratings helper (http://www.concrete5.org/documentation/developers/helpers/ratings/)

I've not used the ratings helper myself, but a quick look at it suggests it will do half stars. You'd just need to pass in a value out of 100, into the function outputDisplay.
servondesign replied on at Permalink Reply
servondesign
Hey Mesuva

Thanks for your prompt reply
5-10 minutes to knock up was the answer I was looking for, so thats great. Do you know of any development notes you know of that outline where to start looking up about "custom select attributes"?

Or alternatively I might put this out as a developer job (albeit I need to get quite a few other things in place first).

thanks
mesuva replied on at Permalink Reply
mesuva
Really what you need to investigate is how to use 'Custom Page Attributes' - the 'Select' type attribute is just one of the various types you can create.

You can create custom attributes via 'Attributes' under Pages & Themes in the Dashboard. Then you can either start adding that attribute against pages in the Properties->Custom Attributes of a page, or you can use it as part of your Composer page setup.

Then on your page type, you could just do simple things like:
<?php $starrating = $c->getAttribute('star_rating'); 
echo $starrating;
?>


..to output your attribute. It's just basic PHP from here and you can do anything you like with the value.

Attributes can be used for other things in like concrete5, like users, files and products, but pages are the best (and easiest) place to start. Something like this tutorial may help if you just follow the bits about the attributes and don't worry about the 'news' aspect -https://www.concrete5.org/documentation/how-tos/developers/create-a-...