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.

Categories not sorting alphabetically

January 04, 2012 10:37pm

Subscribe [3]
  • #1 / Jan 04, 2012 10:37pm

    astuteo

    36 posts

    This question is related to this resolved thread.

    My categories are not sorting correctly on a 2.3.1 installation (EngineHosting). Database shows all “1” for sort_order. I applied the hotfix noted in the aforementioned thread and everything appears to be working correctly, but I’d like to know why this issue still exists 1.5 years after. Obviously I’m worried it will break again with my next system upgrade.

  • #2 / Jan 05, 2012 6:37pm

    Dan Decker

    7338 posts

    Hi astuteo,

    Where are you seeing that the categories aren’t sorted correctly? The {categories} tag pair in your templates should honor the order that they are sorted in the Control Panel. If you choose alphabetical sorting in the CP, you have to be sure to click Update after selecting Alphabetical. I haven’t experienced this issue on my test install of 2.3.1

  • #3 / Feb 10, 2012 10:38am

    Alex Boese

    125 posts

    Just wanted to jump in to say that I’m experiencing the same problem, on a 2.3.1 installation (also EngineHosting). The categories sort alphabetically in the admin page, but not on the publish page. Yes, I’m clicking update after selecting Alphabetical.

    Actually, in my case, I hadn’t changed the categories for years (since running 1.7) and they were sorting correctly. Then I added a category, and the problem started.

  • #4 / Feb 13, 2012 3:43pm

    Dan Decker

    7338 posts

    Hi Alex,

    I just ran a test in 2.3.1 where I added several categories out of alphabetical order, yet the continued to sort alphabetically in Admin->Channel Administration->Categories and in the Categories Tab of the Publish page. I then applied a custom sort, which was also reflected in the Publish Page. After that, I reordered them alphabetically, and they returned to alphabetical sorting in both places.

    It seems I am unable to replicate your issue. Do you have any add-ons that have to do with categories that might be affecting them in your Publish Screen?

    Cheers,

  • #5 / Feb 14, 2012 10:53am

    Alex Boese

    125 posts

    Hi Dan,

    I’m running Playa, though I’m not sure whether that directly affects categories. And anyway, I experienced the problem before installing Playa… so I suspect that’s not the cause.

    If I click on “edit categories” in the Publish page, and then click “done”—the categories will revert to being correctly ordered. But that’s a bit of a nuisance to have to do every time I post an entry.

    The original bug discussed in the resolved thread (linked to above) from 2010 was also difficult for the EE staff to replicate, so it seems like it might be a bit of a slippery bug to pin down.

    astuteo said he applied the 2010 hotfix and that resolved the problem. I tried applying the fix also, but it caused my admin::channel administration::categories page to go entirely blank. I think that may be because I don’t know enough (nothing) about php so I may have done something wrong. Anyway, I reverted to the original admin.content.php file.

  • #6 / Feb 14, 2012 11:06am

    Alex Boese

    125 posts

    Dan,

    After my previous post, I screwed up my courage and partially applied the hotfix from 2010, and it works!  Problem solved. So apparently it must be the same bug from 2010 that’s still lurking around in the code. This is exactly what I did. In system/ee/controllers/cp/admin_content.php:

    $this->process_subcategories($key);  // Sends parent_id
    changed to 
    $this->process_subcategories($key, $this->cat_update);  // Sends parent_id 

    Then, in process_subcategories:

    function process_subcategories($parent_id)
    changed to
    function process_subcategories($parent_id, $carray)

    and then:

    foreach($this->cat_update as $key => $val) 
    changed to
    foreach($carray as $key => $val)

    So, in other words, I didn’t change the part about the “if (AJAX_REQUEST)”—which is what I had inadvertently changed when I initially cut-and-pasted the entire 2010 hotfix.

     

  • #7 / Feb 15, 2012 5:22pm

    Dan Decker

    7338 posts

    Alex,

    Excellent! A bit bothersome that the bug persists though.

    I’ll bring that up with the developers and see if we can nail it down.

    Cheers,

  • #8 / May 10, 2012 4:58am

    jamesaa7

    37 posts

    Incidentally the code above for me (also on 2.3.1) generated a PHP error on updating the category order in CP (but did successfully reorder) the hot fix listed in the top post(page 2) seems to work.

    Cheers

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

ExpressionEngine News!

#eecms, #events, #releases