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.

Category Archive Not Sorting

May 09, 2011 10:35pm

Subscribe [4]
  • #1 / May 09, 2011 10:35pm

    CDT

    93 posts

    I thought this might have been related to the error mentioned here so I updated to build 20110411 (on 2.1.3). (We were already using 2.1.3 so it was a minor upgrade.) I’m not doing anything terribly unusual with the category archive tag. Here’s the tag itself:

    {exp:channel:category_archive style="nested" orderby="title" sort="asc" channel="help"}

    And here’s the rest of the code:

    {categories}
        <h2 class="title_two"><a href="http://{path=help/index}">{category_name}</a></h2>
            {if category_description}
                {category_description}
            {/if}
    {/categories}
    
        {entry_titles}
            <a href="http://{path=help/index}">{title}</a>
        {/entry_titles}
    
    {/exp:channel:category_archive}

    I would expect the results to be in alphabetical order by category name, but it isn’t working out that way. The results are nothing like alphabetical order by category name.

    Is this related to the bug mentioned above or is this something else? The category names on the Control Panel are fixed so maybe this is something else?

    Thanks in advance for any help you can provide.

  • #2 / May 10, 2011 10:23am

    Sue Crocker

    26054 posts

    Hi, CDT. What is the setting showing in the backend?

    Are any of these sub-categories?

  • #3 / May 10, 2011 10:29am

    CDT

    93 posts

    Yes, there are some sub-categories and it is set as alphabetical. They are sorting correctly on the CP now that the Build has updated to the latest one, but the category tags are still wrong (it is doing the same for the channel:categories tag—which I tried to use as a substitute).

    Added: The highest level category isn’t sorting correctly. It looks like the sub-categories are sorting correctly. My list output starts with G. (They are named starting with A, B, C, etc., so it is easy to see that G is coming before A in the list.)

  • #4 / May 11, 2011 3:12pm

    Kevin Smith

    4784 posts

    Hi CDT—

    The sort=”” parameter on the Category Archive tag only affects the sorting of the entries under each category, as noted by the User Guide here, so the category names themselves are sorted based on how they’re sorted in the CP, not based on the parameters.

    Just to clarify, when you say they’re sorting correctly in the CP, are you referring to their order as set in the Category Management section of the CP? If not, take a look there and set the order you’d like the categories to appear on the front end. Make sure you choose Alphabetical below the list and then hit Update.

    Kevin

  • #5 / May 11, 2011 3:32pm

    CDT

    93 posts

    The CP is sorting the category names alphabetically now that I updated to the latest build. The output of the categories are not displaying the same way as the CP. I can PM anyone a link to the CP and a username/password to verify. I was hoping the Build update would solve it, but it only solved the CP problem, not the output.

  • #6 / May 12, 2011 1:50pm

    Sue Crocker

    26054 posts

    Hi, CDT.. I’d be happy to login, but would prefer to also have you test this locally using the newly released 2.1.5 beta.

    NOTE: This is still a beta, and as such is not meant to be run on mission critical sites.

  • #7 / May 12, 2011 1:58pm

    CDT

    93 posts

    Hi, CDT.. I’d be happy to login, but would prefer to also have you test this locally using the newly released 2.1.5 beta.

    NOTE: This is still a beta, and as such is not meant to be run on mission critical sites.

    This is a live site, Sue. Is there a particular file that I could upload that would address this or could I temporarily switch to the latest build to check?

    If 2.1.5 doesn’t make any changes to the database, and I could test it by swapping out the files with a system_old system_new scenario with the system files, I don’t mind testing it in the wee hours of the morning to see if the beta fixes it, as long as there aren’t any issues with a fall back like that.

    If you could let me know, then I could make a more informed decision on how best to proceed.

    Thanks for your help.
    C

  • #8 / May 13, 2011 11:22am

    Kevin Smith

    4784 posts

    Hey C,

    The 2.1.5beta is a pretty significant change, and it makes a lot of changes to the database as well. That’s why Sue was suggesting doing a local upgrade so that you could test with it and see if it made any change to the way category titles are sorted on the front-end without altering your live site. If so, that lets us know the problem is fixed in beta, and might help us offer a temporary solution. If it’s not fixed in beta, then we should file a bug report and get it fixed across the board.

    All that to say, this is definitely not a situation where dropping in a few files from the beta would be a good idea.

    Is it possible for you to upgrade a local install to 2.1.5 Beta?

    Kevin

  • #9 / May 13, 2011 11:39am

    Kevin Smith

    4784 posts

    One more thing to look at, C. If you manually sort the categories in the CP rather than set them to sort automatically, does that sorting match the front-end?

  • #10 / May 13, 2011 1:53pm

    Kevin Smith

    4784 posts

    C, be on the lookout for an email from me in your inbox.

  • #11 / May 13, 2011 3:09pm

    CDT

    93 posts

    I don’t have a way of doing a test locally but I’ll “take one for the team” and test this somehow and get back to you. I’ll also try the manual sort and report back.

  • #12 / May 13, 2011 6:39pm

    CDT

    93 posts

    Custom sorting did change the template order, but it didn’t match the CP. I have no clue what order it was, but it was different from what it had been.

  • #13 / May 14, 2011 11:54am

    CDT

    93 posts

    A testing copy was created to test in 2.1.5:

    1. The custom sorting worked (the template output and the CP were a match). It was also possible to use the arrows to move items up and down on the list to resort them.

    2. The alpha sorting was not working (the template output and the CP were not a match). The CP was sorting alpha, but the template output was not alpha.

    3. Switching back and forth to kick-start the alpha was tried, but no luck.

    Note:  What was interesting is that it remembered the custom sort after switching back from alpha, but there wasn’t a way to get the template output to sort alpha (unless you manually put it in a custom sort by alpha, but that wasn’t done because that would have ruined the test).

    Just as a reminder, the code is textbook category-archive. There’s nothing unusual/special. Everything superfluous was removed from the tag.

    {exp:channel:category_archive style="nested" channel="home"}

    The remainder is:

    {categories}
        <a href="http://{path=help/index}">{category_name}</a>
    {/categories}
    
        {entry_titles}
            <a href="http://{path=help/index}">{title}</a>
        {/entry_titles}
    
    
    {/exp:channel:category_archive}

    That concludes the items you asked us to test. Please let us know if there are any other items we can test on this item to help get it resolved ASAP.

  • #14 / May 14, 2011 3:42pm

    Greg Salt

    3988 posts

    Hi CDT,

    Please check your email.

    Cheers

    Greg

  • #15 / May 19, 2011 1:17pm

    Sue Crocker

    26054 posts

    Hi, Connie.

    There is something weird going on here. I was able to get things working by doing the following:

    Set the categories to be Custom, and then order them alphabetically the way you want. Not an ideal solution, but I did try it.

    I have a slightly different build to test with, and will look there to see if we can get this fixed for you.

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

ExpressionEngine News!

#eecms, #events, #releases