Category Ordering by Rating of categories

Phoca Gallery - image gallery extension
dr.archik
Phoca Member
Phoca Member
Posts: 23
Joined: 14 Aug 2009, 23:05

Category Ordering by Rating of categories

Post 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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47883
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category Ordering by Rating of categories

Post 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
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47883
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category Ordering by Rating of categories

Post by Jan »

Will be added to 2.7.1

Jan
If you find Phoca extensions useful, please support the project
koyot777
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 04 May 2015, 04:40

Re: Category Ordering by Rating of categories

Post 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?
Post Reply