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 variable pair show_group strange behaviour

December 08, 2010 2:47pm

Subscribe [7]
  • #1 / Dec 08, 2010 2:47pm

    Elliot Lewis

    49 posts

    I’m not sure whether this is a bug or not but EE is doing something strange.

    I have a channel called Events. I have 2 Category groups, Event Type and Location assigned to the Events Channel.
    There are 10 Categories in Category Group 1 (Type) and 40 in Category Group 2 (Location).

    The following code works as expected, outputting all categories for an event:

    {categories backspace="2"}
    {category_name}, 
    {/categories}

    Output:
    Activities, London

    Where Activities has an ID of 2 and London 11.

    The following code does not work:

    {categories show_group="1"}
    {category_name}
    {/categories}

    EE should output just Activities but nothing appears (in this example). Other event entries do display correctly with any of the other 9 categories in category group Event Type.

    It get stranger…

    {categories show_group="2"}
    {category_name}
    {/categories}

    Outputs:
    Activities, London

    But Activities is not in Category Group 2!

    This is only happening with this specific Category (ID 2) from this group.

    Any thoughts?

  • #2 / Dec 09, 2010 11:01am

    Sue Crocker

    26054 posts

    Hi, Elliot. Which build/version of EE2.x are you using? You can find that out at the bottom of any control panel page. (Not in the Info accessory.)

  • #3 / Dec 09, 2010 11:15am

    Elliot Lewis

    49 posts

    Build:  20100810
    Addons: User, Matrix, Low Seg2Cat

  • #4 / Dec 10, 2010 3:03am

    John Henry Donovan

    12339 posts

    Elliot,

    I can’t replicate in my testing in the latest build of EE. Can upgrade your version please to the latest Build (20101020)?

  • #5 / Dec 13, 2010 10:04am

    Elliot Lewis

    49 posts

    I’ve updated to the latest version 2.1.1 Build:  20100810 but I’ve still got the same problem.
    Is there a hidden option in EE to switch a category to a different group without knowing it?! I have no idea where to start trying to debug this.

  • #6 / Dec 13, 2010 5:07pm

    Ingmar

    29245 posts

    Can you show us a little more of your code, including the channel:entries tag? You might also want to disable extensions and other third-party add-ons during testing.

  • #7 / Sep 28, 2011 9:32am

    Pv Ledoux

    95 posts

    Hi there,

    same problem here:

    {exp:channel:entries channel="video"
          disable="member_data|pagination"
          limit="1"
          orderby="entry_date"
          sort="desc"
          status="published|archived"
          require_entry="yes"}
    
    {categories show_group="5"}{category_name}{/categories}
    
    {/exp:channel:entries}

    This code is not working with show_group=“5”, but it output the categories as soon as I remove this parameter.

    I running EE 2.1.3, build 20110411.

    Regards,

    Pv

  • #8 / Sep 28, 2011 10:25am

    Pv Ledoux

    95 posts

    Edit: I think I found the problem: the table exp_category_field_data was containing wrong group_id (all groups id were incremented by 1). I replaced with good groups id, and now it’s ok. I don’t know why those ids was not corresponding to the group ids.

  • #9 / Sep 28, 2011 12:23pm

    Elliot Lewis

    49 posts

    Excellent Pv Ledoux! Thanks for finding this bug. That’s fixed it for me as well.

    Just to be clear I’ve screen grabbed where the problems are. I’d not thought to look at the database as EE was showing the category in the right category group in the CP!

    This is a weird EE bug, I have no idea how both of us have ended up with this problem but I definitely hadn’t manually altered the db table, so this is a CP bug.

    As you can see from the screen grabs category 2 is listed as in group 1 in the CP but in the DB it’s listed to group 2?!

  • #10 / Sep 29, 2011 4:16am

    Pv Ledoux

    95 posts

    Yep it’s really weird, I don’t know why there is this shift in this table. I don’t have the problem on other sites with the same version.

  • #11 / Sep 29, 2011 12:01pm

    Mark Bowen

    12637 posts

    Hi Elliot,

    Did you perform any imports of data to this site at all? Specifically channel imports perhaps using something like DataGrab?

    Thanks,

    Mark

  • #12 / Sep 29, 2011 12:17pm

    Elliot Lewis

    49 posts

    You must be a fortune teller 😉

    This site was an EE1 site and had a complete refresh to an EE2 but some content was required so I think I did use DataGrab.
    I’m not sure this is the culprit though as that data was for a different channel and didn’t use any categories.

  • #13 / Oct 02, 2011 4:17pm

    Kevin Smith

    4784 posts

    Hi Elliot,

    The only times we’ve seen this kind of weird stuff show up in the database is when DataGrab has been used for an import, which is why Mark was able to nail it. 😊

    Do you happen to have a backup of your database back from its EE1 days in order to compare the category data info? If it wasn’t corrupted in EE1 and you used DataGrab to pull stuff from EE1 into a fresh install of EE2, I’d say that’s the only real explanation.

  • #14 / Oct 03, 2011 4:48am

    Elliot Lewis

    49 posts

    I do have a backup, but that won’t help because the channel, fields and categories are all new to the new version of the site. The old EE1 version had some data which was pulled in first, this was just field data (text) without any categories. Datagrab could be the problem but I’m not sure how.

    For me the problem is solved. It’s just strange the EE CP showed the category in the correct group but it’s clearly not in the DB, EE’s tag was correct all along.

  • #15 / Oct 03, 2011 12:03pm

    Mark Bowen

    12637 posts

    Hi Elliot,

    Glad you’ve got this all sorted now.

    If anything else crops up then please don’t hesitate to post again as needed.

    Cheers,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases