Jump to content

Recommended Posts

Posted (edited)

Hi Everyone!

I'm sorry in advance if my issue was solved somewhere here (haven't found it) but I've stuck with sorting...
I've got a field where I put Polish surnames and sorting pages by it displays incorrect results according to Polish alphabet:
"ą" shoud be after "a", "ć" after "c" etc. Now these letters are treated like English ones.
So for example displayed surnames "Bać, Bąk, Bal" shoud be in order "Bać, Bal, Bąk".

My selector is let's say:
$guys = $pages->find("template=guy, sort=guy_surname");

And I don't have an idea what to do now and how to change this sorting. I tried to use some PHP sort functions but didn't make it working properly (or at all). Maybe there's a much simpler PW-way solution?

Any help or tip? ??

EDIT:

Of course there's a simple solution. ?

$guys = $pages->find("template=guy");
$guys->sort("guy_surname", SORT_LOCALE_STRING);

Now I'm trying to figure out how to paginate the results AFTER sorting. But that's not crucial for us in this case.

EDIT #2:

This place is - as always - a den full of treasures. ? I've used PaginatedArray and adapted this code. It allows me to conviniently divide pages with hundreds of items which were sorted properly earlier. ?

Edited by Chris Ernovsky
Explaining the solution.
  • Chris Ernovsky changed the title to [SOLVED] Sorting by non-English alphabet + pagination

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...