Jump to content
Soma

Is sort by subfield supported?

Recommended Posts

I'm not sure and in a hurry :)

Share this post


Link to post
Share on other sites

From previous experience (and have also just now quickly tested), as long as the subfield is a db column name, it should work...so..

$items = $pages->find("sort=parent.title, limit=50");

will not work...you will get an error about column not found...but...

$items = $pages->find("sort=parent.name, limit=50");

will work...

  • Like 1

Share this post


Link to post
Share on other sites

Just to clarify, according to Ryan's commit and comment and ESRCH PR, this only applies to FieldtypePage. Unless am missing a trick, the below still doesn't work

$items = $pages->find("sort=parent.title, limit=50");

Share this post


Link to post
Share on other sites

I'm running 2.5.3 and hitting an error when trying to sort like this:

sort=facility_page.title,sort=end_datetime

using the title of a subfield, and getting back

Column not found: 1054 Unknown column '_sort_page_facility_page_title.title' in 'order clause' 

It looks like the fix ESRCH references in this post will fix it.  But I'm too much of a noob to figure out which release I need to upgrade to for the fix.

Can someone smarter than me look it up?

Share this post


Link to post
Share on other sites

Your installed PW version is from October 2014, while this fix / addition was a few months later. So I'd suggest to move up to 2.7.

I recently upgraded an old site from 2014 to PW3 latest dev, and I didn't have to change that much. Mainly updating modules (or simply adding PW3 namespaces). Of course, with a live site, do it locally first.

  • Like 1

Share this post


Link to post
Share on other sites

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...