Page 1 of 1

Category Ordering by Rating of categories

Posted: 15 May 2010, 17:20
by dr.archik
Category Ordering by Rating of categories
Image
Sorry for my English.
Hello "Jan", my name is Arthur, I from Russia (hockey, bears, Red Square :lol: ).
I want that you have added my solution in the following version Phoca Gallery, because I consider it as perfect addition for this gallery.

GO ...
1) Edit file "www\administrator\language\en-GB\en-GB.com_phocagallery.ini" ADD

Code: Select all

#2.7.1 Beta
COUNT ASC = Vote count Ascending
COUNT DESC = Vote count Descending
AVERAGE ASC = Vote average Ascending
AVERAGE DESC = Vote average Descending
2) Edit file "www\administrator\components\com_phocagallery\libraries\phocagallery\ordering\ordering.php"
function getOrderingString ($ordering) - added 4 new case ( 11,12, 13 ,14)
In the line №47 add code:

Code: Select all

			case 11:
				$orderingOutput	= 'count ASC';
			break;
			case 12:
				$orderingOutput	= 'count DESC';
			break;
			
			case 13:
				$orderingOutput	= 'average ASC';
			break;
			case 14:
				$orderingOutput	= 'average DESC';
			break;
3) Edit file "www\administrator\components\com_phocagallery\config.xml"
In the line №426 add new options for (param name="category_ordering"):

Code: Select all

<option value="11">Count ASC</option>
	<option value="12">Count DESC</option>
	<option value="13">Average ASC</option>
	<option value="14">Average DESC</option>
4) Edit file "www\components\com_phocagallery\models\categories.php"
In the line №112 add new variable name "votes" and add check on rating ordering:

Code: Select all

	
$votes=' ORDER BY cc.';
switch ($categoryOrdering) {
  case 'count ASC':
    $votes=' ORDER BY r.';
    break;
  case 'count DESC':
    $votes=' ORDER BY r.';
    break;
  case 'average ASC':
  $votes=' ORDER BY r.';
    break;
  case 'average DESC':
  $votes=' ORDER BY r.';
   break;
  default:
 $votes=' ORDER BY cc.';
}
Edit sql query. In the line №128
replace this code

Code: Select all

. ' ORDER BY cc.'.$categoryOrdering;
on this code

Code: Select all

.$votes.$categoryOrdering;
It is as a result we have Category Ordering by user rating.
It is possible to do for images too.

Re: Category Ordering by Rating of categories

Posted: 17 May 2010, 14:07
by Jan
Hi, thank you for the improvement.

I will add it to the next release.

Jan

BTW:
I from Russia (hockey, bears, Red Square :lol: ).
Я до сих пор не понимаю, в какой стране вы имеете в виду :D

Re: Category Ordering by Rating of categories

Posted: 18 May 2010, 15:44
by Jan
Will be added to 2.7.1

Jan

Re: Category Ordering by Rating of categories

Posted: 15 May 2015, 15:53
by koyot777
Figured out how to remove unnecessary sorting and we would like to conclude these sorts of a link, to form not a dropdown list and three references with sorting by number of votes and by date.

Tell me how can I implement this in this gallery?

Whatever you may have ideas?