MODX Community

XPDO Sort By Multiple Columns

I’m wondering how I go about sorting on more than one column with XPDO or even if it’s possible. The docs (https://docs.modx.com/3.x/en/extending-modx/xpdo/class-reference/xpdoquery/xpdoquery.sortby) make no mention of it.

You can call sortby repeatedly for each ordering you want to add.

Ah right, thank you Mark and the info is findable here now for anyone else looking.

If it doesn’t work please show your code. Buy withdrawing your posts I assume you got it figured out?

Initially thought it wasn’t, then I realised it was but wasn’t what I needed in my particular case. I’ll need to use array_multisort on the results for the sorting I need.

I salute your eagerness to help.

1 Like