Sorting a pagelist by a custom attribute and name
Permalink
I have a custom select attribute called job_title (each person has a job title), options are something like this:
Partners
Solicitors
Finance
Administration
I need to be able to sort the page list firstly alphabetical (name) and then by the job_title attribute. So what I need it for all the people associated with 'Partners' to be displayed first followed by everyone else.
I've found the following function:
This displays the people, sorts by the job_title and persons name in alphabetical order which is not what I need.
Partners
Solicitors
Finance
Administration
I need to be able to sort the page list firstly alphabetical (name) and then by the job_title attribute. So what I need it for all the people associated with 'Partners' to be displayed first followed by everyone else.
I've found the following function:
$pl->sortByMultiple('ak_job_title asc', 'cName asc');
This displays the people, sorts by the job_title and persons name in alphabetical order which is not what I need.
How big is the list?
Currently 145 but will not get much bigger.
What happens if you just flip the parameters to sortByMultiple about?
For other solutions:
My Uber List addon with Magic Data should be able to easily cope with that with no perceptible delay.
You could also have a look at PagList+. It has 2 levels of sort built in.
For other solutions:
My Uber List addon with Magic Data should be able to easily cope with that with no perceptible delay.
You could also have a look at PagList+. It has 2 levels of sort built in.