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

orderby not working?

Development and Programming

pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

I have this code to display jobs in a menu:

{exp:channel:entries channel="careers" category="19" dynamic="off" orderby="title" sort="asc"}
            <a href="http://{base_url}careers/{url_title}">{title}</a>
         {/exp:channel:entries}

it was working fine until we added two new entries which are out of order: http://www.vacco.com/careers/ehs-specialist

any ideas why the orderby is not working?

(no sticky entries in this channel)

thanks

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
9 years ago
John Henry Donovan's avatar John Henry Donovan

Hi Pirco,

Any nesting of tags going on there? What is surrounding what you have there to create the rest of the menu?

Can you try making a new blank template and add just your exp:channel:entries tag to it.

JH

       
pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

no nesting tags. I created a blank template with nothing but this code:

{exp:channel:entries channel="careers" category="19" dynamic="off" orderby="title" sort="asc"}
    <a href="http://{base_url}careers/{url_title}">{title}</a>
{/exp:channel:entries}

http://www.vacco.com/careers/test

what else could influence the sort order?

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
9 years ago
John Henry Donovan's avatar John Henry Donovan

You could try ordering by another value like date or url_title. You using any third-party add-on like Structure? What version of EE are you using?

       
pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

it’s v 2.4 but I would assume that sort order wouldn’t be an issue.

I can order fine by other parameters like date or custom field but both title and url_title do the same: they sort alphabetically EXCEPT for the latest three records!

no major add-on besides ‘freeform’, ‘wygwam’ and ‘SEO lite’

       
pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

I’ve expanded the test page: http://www.vacco.com/careers/test

to show different results for orderby ‘date’, ‘title’ and ‘url_title’, both ascending and descending.

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
9 years ago
John Henry Donovan's avatar John Henry Donovan

Can you try the channel entries tag without the category parameter?

Try turning on Output and Debugging and inspecting the query that lists those entries to see what turns up.

I would also be looking at the database to inspect those entry rows to see if there is anything different about them.

They would be my next steps

       
pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

thank you for that. that’s a bit above my pay grade but my rudimentary review showed no signs of anything different for these entries in the database itself.

I do see a lot of queries (66) for this test page (which seems high) but, again, difficult for me as a front-end developer to tell what to look for. except, I do see the queries that pull these jobs and all I can see is that the ORDERBY does not include any of my specified parameters

ORDER BY c.group_id, c.parent_id, c.cat_order

perhaps that ordering is sorted somewhere else but, for now, I told my client that it looks like a bug.

thanks again for your time and help.

       
pirco's avatar
pirco
218 posts
9 years ago
pirco's avatar pirco

what’s most disconcerting is that even orderby=”date” doesn’t work. http://www.vacco.com/careers/test

       

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.