We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How do I order by multiple fields? EE is ignoring my second field

How Do I?

dmDev08's avatar
dmDev08
100 posts
7 years ago
dmDev08's avatar dmDev08

I’m doing:

But the values in the secondary field never change the order. They’re always in alphabetical order. What i want is to have the order of Item 1, Item 3, Item 2 in the below example:

Item 1:

title: A title
secondary_order: 0

Item 2:

title: A Second title
secondary_order: 3

Item 1:

title: A Third Title
secondary_order: 0

you can see that alphabetically, they’d be Item 1, 2, 3, but then the second item has a higher sort order and so would be put last.

How would I do this?

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Can you share your opening tag? Also can you clarify your example? You have two pseudo entries labeled “Item 1”, and they aren’t presented in alphabetical order by title, so I’m unclear if you’re showing what it should be, or showing unexpected results of your tag.

In general though, ordering by multiple things is similar to ordering multiple items in a table (or a spreadsheet). The sort will occur on the first field, and then for any items that have a duplicate value for the first sort, will be ordered by the second. For instance, ordering by last_name|first_name:

Doe, Jane
Doe, John
Frank, Bob
Smith, Aaron
Smith, Tom
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.