Jump to content

Selectors sort by parent title|id


ttttim
 Share

Recommended Posts

I have an event page were you can select multiple sub-categories with a page field using checkboxes. Now i want to display all the sub-categories but also have them sorted by their parent category. I tried something lik below but that didn't work.

$tags = $event_cat->find("sort=$event_cat->parent");
foreach ($tags as $tag){
	echo $tag;
}

Any ideas?

Link to comment
Share on other sites

Hi Tim,

What is the structure of your tree? I've read your question twice, but can't seem to understand what you mean. You can sort by subfields like:

$pages->find("template=test, sort=parent.title, sort=page_field.sort");

Perhaps that is what you are looking for?

  • Like 1
Link to comment
Share on other sites

If your parent categories are siblings you can do this:

$page->my_page_field->sort("parent.sort");

(You can do it anyway even if they're not siblings but the sort might not make much sense in that case.)

  • Like 1
Link to comment
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
 Share

×
×
  • Create New...