Elxis CMS Forum

Support => Technical support => Topic started by: wilmap on December 12, 2011, 07:11:38

Title: Changing Star Ratings
Post by: wilmap on December 12, 2011, 07:11:38
In Australia we have half star ratings. I have drawn up additional star pngs for the 2.5, 3.5, 4.5  ratings and can find reference to them in 'reservations.class.php' and 'hotels.controller' where I have changed to the following, but it is not finding them.
$stars = array();
      $stars[] = mosHTML::makeOption('0', '0 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('1', '1 '.$resmaster->lng->STAR.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('2', '2 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('3', '2-5 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('4', '3 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('5', '3-5 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('6', '4 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('7', '4-5 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('8', '5 '.$resmaster->lng->STARS.' ('.$resmaster->lng->HOTEL.')');
      $stars[] = mosHTML::makeOption('10', '0 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('11', '1 '.$resmaster->lng->KEY.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('12', '2 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('13', '2-5 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('14', '3 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('15', '3.5 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('16', '4 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('17', '4-5 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
      $stars[] = mosHTML::makeOption('18', '5 '.$resmaster->lng->KEYS.' ('.$resmaster->lng->RENTROOMS.')');
       $lists['stars'] = mosHTML::selectList($stars, 'stars', 'class="selectbox" size="1"', 'value', 'text', $row->stars);

Is there a place wher I can input these new required ratings.  Also if I call them '3.5' for example do I need to '\' backslash the period.
Thanks
Pete
edit by datahell: Email address removed in order to avoid spam on your mailbox.
Title: Re: Changing Star Ratings
Post by: datahell on December 12, 2011, 20:59:52
No, hotels stars must be integers as they are saved as integers in the database.

I will show you a solution but I strongly suggest you NOT to do it as it requires many changes in IOSR and most probably you will do it wrong.

Integers 0 to 9 are reserved for hotels (0-5 are already in use).
Integers 10 to 19 are reserved for Apartments / Rooms to let (10-15 are already in use).

The trick is to use the unused integers for your new stars and do a conversion before display them (method kratiseis::starimage).
For instance I can map integer 6 to star 2.5, integer 7 to star 3.5 and 8 to star 4.5.
Also I can map integer 16 to key 2.5, integer 17 to key 3.5 and integer 18 to key 4.5.