Jump to content


Photo

Sort the selectors results by template name

template name sort selectors

  • Please log in to reply
4 replies to this topic

#1 seddass

seddass

    Distinguished Member

  • Members
  • PipPipPip
  • 56 posts
  • 8

Posted 03 May 2012 - 08:47 AM

I am wandering to find out if it is easy something like:

"..., sort=template, ..."
or
"..., sort=template.name, ..."

for sorting the pages by their template name in selectors result.

When it will be useful:
1. My clients were asking to display the professors first, then doctors, then students in the paginated staff list.
2. Other clients requested to display products pages first in the site search results.

I know I could use two search selectors and to concatenate their PageArrays but it will be more complicated with the pagination. I could use a dropdown with "search in products", "search in site" too.

#2 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3117

  • LocationAtlanta, GA

Posted 03 May 2012 - 11:21 AM

Seems like a great idea -- I just now added it in the latest commit. Now it should support the "sort=template".

#3 seddass

seddass

    Distinguished Member

  • Members
  • PipPipPip
  • 56 posts
  • 8

Posted 03 May 2012 - 12:31 PM

Awesome, thanks!

#4 Soma

Soma

    Hero Member

  • Moderators
  • 3,188 posts
  • 1745

  • LocationSH, Switzerland

Posted 03 May 2012 - 12:49 PM

Great to have this. Thanks guys. Just to verify, it will "group" and sort by template name? So the problem of having a specific order would only be able with naming the templates according 01-tplx, 02-tply, 03-tplz? Since templates can also have labels this won't be much of a problem I guess.

@somartist | modules created | support me, flattr my work flattr.com


#5 adamkiss

adamkiss

    Master of the universe

  • Moderators
  • 1,078 posts
  • 289

Posted 31 May 2012 - 04:51 AM

@Soma - I guess that could work, but this is probably better to use just to group the templates together and then parse the PageArray and set correct order, so you don't run into problem with different orders needed with 'XX-template' system.

Example: on search, you need 01-tpl1, 02-tpl2, 03-tpl3. On a different listing, you'll need 03-tpl3, 01-tpl1, 02-tpl2 in this order, and then you're screwed. But this is just a note, you may not run into this issue (if you have one search only, for instance ;)





Also tagged with one or more of these keywords: template, name, sort, selectors

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users