ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Problem with sorting by custom field.

June 24, 2007 3:51pm

Subscribe [3]
  • #1 / Jun 24, 2007 3:51pm

    Linda A

    666 posts

    I am having some problems with sorting by a custom field. On the same page, it works for one set of entries but not for another. I have cleared the cache, and this makes no difference. I am not sure if I am doing something wrong or if there’s something buglike going on here.

    Page: http://www.westeros.org/BoD/FAQ/

    Issue: Entry 1.3.3. sorts before entry 1.3.1. and 1.3.2. These entries are set to sort by a custom field, and the content of said custom field for these entries is 01.03.03. and 01.03.01. and 01.03.02. What really mystifies me is that it works just fine for entries 1.2.1. through to 1.2.6., for example.

    Code:

    <ul class="NestedNone">
    <li>1. <a href="http://www.westeros.org/BoD/FAQ/Category/C146/">About the Game</a>
    <ul>
    <li>1.1. <a href="http://www.westeros.org/BoD/FAQ/Category/C150/">Basics</a>
    <ul>
    {exp:weblog:entries weblog="{current_weblog}" category="176" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>
    </li>
    <li>1.2. <a href="http://www.westeros.org/BoD/FAQ/Category/C150/">Setting</a>
    <ul>
    {exp:weblog:entries weblog="{current_weblog}" category="150" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>
    </li>
    <li>1.3. <a href="http://www.westeros.org/BoD/FAQ/Category/C149/">Policy</a>
    <ul>
    {exp:weblog:entries weblog="{current_weblog}" category="149" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>
    </li>
    </ul>
    </li>
    <li>2. <a href="http://www.westeros.org/BoD/FAQ/Category/C147/">Character Setup</a>
    <ul>
    {exp:weblog:entries weblog="{current_weblog}" category="147" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>
    </li>
    <li>3. <a href="http://www.westeros.org/BoD/FAQ/Category/C148/">For Newbies</a>
    <ul>
    {exp:weblog:entries weblog="{current_weblog}" category="148" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>
    </li>
    </ul>
  • #2 / Jun 24, 2007 11:12pm

    Sue Crocker

    26054 posts

    Hi, Linda.

    Is this the same thing you were trying to get to work with 1.5.2?

    Did you change the default format for that field earlier? Or what is different now?

  • #3 / Jun 24, 2007 11:14pm

    Derek Allard

    3168 posts

    Hmm, ok let’s reduce this one a bit ok Linda.  If you put just

    {exp:weblog:entries weblog="{current_weblog}" category="149" orderby="{current_weblog_id}_number_sorting" sort="asc" disable="member_data|pagination|trackbacks}
    <li>{{current_weblog_id}_number_display} <a href="{comment_entry_id_auto_path}">{title}</a></li>
    {/exp:weblog:entries}

    in a blank template, what do you get?  If you turn on queries, does that show anything noteworthy?

  • #4 / Jun 25, 2007 4:29am

    Linda A

    666 posts

    Sue,

    I am still on 1.5.2. I have a couple of hacks that I can’t figure out how to do on 1.6, so I haven’t been able to upgrade yet. This code was working fine earlier, though, until I added afew more entries some days ago, and then it broke.

    Derek,

    Same result in a blank template. I turned on queries, but that test page doesn’t show any at all when I reload (even after clearing the cache). Other pages show them, though.

  • #5 / Jun 25, 2007 4:32am

    Linda A

    666 posts

    Err, okay, nevermind about the queries. Wrong url, so it wasn’t seeing me as logged in. Not quite sure what to look for in them, though.

    SQL QUERIES
    1
    SELECT DISTINCT ee.* FROM exp_extensions ee WHERE enabled = 'y' ORDER BY hook, priority ASC, class
    2
    SELECT member_id, admin_sess, last_activity FROM exp_sessions WHERE session_id = '323234608e09aa915ac7ea48983278643fcc1876' AND ip_address = '81.224.99.122' AND user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv'
    3
    SELECT m.weblog_id, m.tmpl_group_id, m.username, m.screen_name, m.member_id, m.email, m.url, m.location, m.join_date, m.last_visit, m.last_activity, m.total_entries, m.total_comments, m.total_forum_posts, m.total_forum_topics, m.last_forum_post_date, m.language, m.timezone, m.daylight_savings, m.time_format, m.profile_theme, m.forum_theme, m.private_messages, m.accept_messages, m.last_view_bulletins, m.last_bulletin_date, m.display_signatures, m.display_avatars, m.last_email_date, m.notify_by_default, m.ignore_list, g.* FROM exp_members AS m, exp_member_groups AS g WHERE unique_id = 'beb6ddd808361e0e7232e45a040ddc2cbcfefbf4' AND password = 'b3944e73755fb04a1fa45efb5ab099247f04d5c2' AND m.group_id = g.group_id
    4
    UPDATE `exp_sessions` SET `session_id` = '323234608e09aa915ac7ea48983278643fcc1876', `member_id` = '1', `admin_sess` = '1', `ip_address` = '81.224.99.122', `user_agent` = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv', `last_activity` = '1182778285' WHERE session_id ='323234608e09aa915ac7ea48983278643fcc1876'
    5
    SELECT * FROM exp_online_users WHERE date > 1182777385 AND weblog_id = '0' ORDER BY name
    6
    UPDATE `exp_online_users` SET `weblog_id` = '0', `member_id` = '1', `name` = 'Linda', `ip_address` = '81.224.99.122', `date` = '1182778285', `anon` = '' WHERE ip_address = '81.224.99.122' AND member_id = '1'
    7
    SELECT * FROM exp_stats WHERE weblog_id = '0'
    8
    UPDATE exp_stats SET last_visitor_date = '1182778285' WHERE weblog_id = '0'
    9
    SELECT group_id FROM exp_template_groups WHERE group_name = 'FAQ'
    10
    SELECT COUNT(*) AS count FROM exp_templates WHERE group_id = '46' AND template_name = 'Test'
    11
    SELECT exp_templates.template_name, exp_templates.template_id, exp_templates.template_data, exp_templates.template_type, exp_templates.edit_date, exp_templates.save_template_file, exp_templates.cache, exp_templates.refresh, exp_templates.no_auth_bounce, exp_templates.enable_http_auth, exp_templates.allow_php, exp_templates.php_parse_location, exp_templates.hits, exp_template_groups.group_name FROM exp_template_groups, exp_templates WHERE exp_template_groups.group_id = exp_templates.group_id AND exp_templates.template_name = 'Test' AND exp_template_groups.group_name = 'FAQ'
    12
    UPDATE exp_templates SET hits = '5' WHERE template_id = '666'
    13
    SELECT variable_name, variable_data FROM exp_global_variables WHERE user_blog_id = '0'
  • #6 / Jun 25, 2007 8:10am

    Derek Allard

    3168 posts

    Did you define {current_weblog} and/or replace it with a hard-coded weblog?  Also, I was missing a quote in the disable parameter (sorry).  I missed it as I copied and pasted your code, so you’re also missing it.  Try putting them all in.  Could you double check and try again?

  • #7 / Jun 25, 2007 8:19am

    Linda A

    666 posts

    Yes, I defined {current_weblog}. It showed the entries, just in the same (wrong) order as before.

    I added in the missing quote in the disable parameter, but no difference with that either.

    Test page is here: http://www.westeros.org/BoD/FAQ/Test/

  • #8 / Jun 25, 2007 8:22am

    Derek Allard

    3168 posts

    OK, let us dig into these a bit more carefully for you Linda… we’ll get it wrapped up for you.

  • #9 / Jun 25, 2007 8:27am

    Linda A

    666 posts

    One thought just struck me. Way back, I had an issue with an entry ending up sticky even though I had not set it sticky (that weblog, like this one, doesn’t even have the sticky checkbox displayed on the Publish page). I will need to turn that checkbox on and see if it somehow has been set.

  • #10 / Jun 25, 2007 8:29am

    Linda A

    666 posts

    Yup, that was indeed the problem. That is very odd, because ‘Display Option Buttons’ has never been turned on for this weblog. So it must be related to the other bug, where Sticky could get turned on under certain circumstances.

    I’ll see if I can find that topic.

    Edited to add the topic link: http://ellislab.com/forums/viewthread/42446/

    I don’t think I have done any multi-edits since I added this entry, however.

  • #11 / Jun 25, 2007 8:37am

    Derek Allard

    3168 posts

    Could you post the test template you’re using for me?  I just built a test case for me and it worked perfectly, BUT I am on 1.6.  Also, just to cover bases, the custom field formatting is “none”?

  • #12 / Jun 25, 2007 8:42am

    Linda A

    666 posts

    See my updated post just before yours. 😊 The post was somehow set Sticky, even though I’ve never even had the option buttons enabled for the weblog.

  • #13 / Jun 25, 2007 8:50am

    Derek Allard

    3168 posts

    Yee-haw - odd, but glad its fixed up 😊

    If you ever figure out any odd behaviour about why it might have gotten on sticky, let me know and we’ll track it down for you!

  • #14 / Jun 25, 2007 8:58am

    Linda A

    666 posts

    Will do. 😊 The multi-edit bug that turned on sticky should be all squashed though, right?

  • #15 / Jun 25, 2007 9:42am

    Derek Allard

    3168 posts

    If its in the bug-tracker, we’re on it.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases