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.

Another option instead of using 2 category groups?

October 05, 2012 4:43pm

Subscribe [2]
  • #1 / Oct 05, 2012 4:43pm

    The Design Core

    359 posts

    I have a channel that stores apartment info such as the number of bedrooms, number of bathrooms, square footage and floor number.

    There will be a navigation list in the sidebar that will let you filter the apartments by number of bedrooms, so I was thinking that would be perfect for a category group.

    My issue is that the filtered channel entries need to then be sorted/organized by floor number. So basically when you click to see one bedroom apartments, the channel entries should list them out like so:

    Floor 12
    - Entry 1
    - Entry 2
    - Entry 3

    Floor 13
    - Entry 1
    - Entry 2
    - Entry 3

    Floor 14
    - Entry 1
    - Entry 2
    - Entry 3

    And so on.

    Is there a better/easier way to achieve this without using 2 category groups, one for the number of bedrooms and one for the floor numbers?

    Thanks for any help.

  • #2 / Oct 05, 2012 5:15pm

    Have you looked into setting this up as reverse related entries, rather than a categorical listing? That’s how I generate dropdown navs, which have a very similar structure.

    {exp:channel:entries channel="channel" dynamic="no"} 
      {title} - Title of the floor
        {reverse_related_entries dynamic="no" orderby="title" sort="asc"}
          {title} - title of the entry related to that floor
        {/reverse_related_entries}
    {/exp:channel:entries}
  • #3 / Oct 05, 2012 5:26pm

    The Design Core

    359 posts

    Not sure I totally follow. There is only one channel, so what would the entries be relating to? Wouldn’t you need a second channel?

  • #4 / Oct 05, 2012 5:28pm

    The Design Core

    359 posts

    And the floor listing in my post is not a nav. It’s the actual page content. The floor number would be a header and the entry data for that floor would list out below it.

  • #5 / Oct 05, 2012 5:33pm

    Set up a new custom field within that channel - a Relationship Field that lists the titles of all the entries of that channel.

    On the entry publish field, it will list the titles of both the floors and the entries. One option at this point is to split this into 2 channels (one for floors, one for entries), like you were thinking. That would make the list shorter, but it’s not necessary.

    Now when you publish a new entry, tag the title of the floor the entry is associated with.

    Nav or not, it’s still a similar parent-child structure. 😉

  • #6 / Oct 05, 2012 6:03pm

    The Design Core

    359 posts

    How will it list the title of both the floors & the entries? Where is it getting the floor info from?

    I appreciate your help, but I’m really missing something here.

  • #7 / Oct 05, 2012 6:16pm

    OK, in light of that, it probably would be best to sort it into 2 channels. One for floor and one for entries. In the entries channel fields, set up the relationship field to relate to the floors channel.

    {exp:channel:entries channel="floor" dynamic="no"} 
      {title} - Title of the floor
      {floor_info} - Info regarding that floor
        {reverse_related_entries dynamic="no" orderby="title" sort="asc"}
          {title} - title of the entry related to that floor
          {entry_info} - info for the entry related to that field
        {/reverse_related_entries}
    {/exp:channel:entries}

    That will render like:

    Floor 1 Title
    Floor 1 info
      Floor 1 related entry 1
      Floor 1 related entry 1 info
      Floor 1 related entry 2
      Floor 1 related entry 2 info

    Floor 2 Title
    Floor 2 info
      Floor 2 related entry 1
      Floor 2 related entry 1 info
      Floor 2 related entry 2
      Floor 2 related entry 2 info

    Here’s a link to the relationship field in the user guide.
    http://ellislab.com/expressionengine/user-guide/modules/channel/relationships.html

  • #8 / Oct 05, 2012 6:39pm

    The Design Core

    359 posts

    That makes more sense.

    Seems a bit overkill to use a channel just for floor numbers (there is no other floor information) but I do like the idea better than 2 category groups.

    Not completely sold on the idea yet but it is certainly an option. Thanks for your help!

    Anyone have any other thoughts on this scenario?

  • #9 / Oct 06, 2012 10:53am

    The Design Core

    359 posts

    Porter,

    So I gave your idea a shot and it does give me the display the way I need it, but the category filtering part of it does not work.

    Each entry is assigned a category by the number of bedrooms. There is a navigation that lets you select which apartments you want to view by the number of bedrooms. One Bedrooms, Two Bedrooms, etc.

    I set dynamic=“yes” to the code you provided, but the category trigger in the URL does not filter the entries.

    Any thoughts on this?

  • #10 / Oct 08, 2012 9:14am

    I’m glad that worked out. I was beginning to worry I was overcomplicating the issue. I use that technique all the time for grouping entries.

    So far as the category breakdown goes, I don’t really know. Sorry.

    Are you activating the categories from within your entries call?

    As in

    {channel:entries channel="channel"}
      The category ID for this entry is {categories}{category_id}{/categories}.
    {/channel:entries}
  • #11 / Oct 08, 2012 10:03am

    The Design Core

    359 posts

    I can display the categories for the entries just fine, but since the reverse_related_entries tag does not have any parameters that let you specify categories, I’m not sure how to filter the list based on a category selection.

    The categories are associated with the reverse related entries (the apartments channel) not the floors channel.

  • #12 / Oct 08, 2012 10:16am

    Don’t know, mediapimp.

    That one stumps me.

  • #13 / Oct 08, 2012 10:22am

    The Design Core

    359 posts

    Ok. Thanks for your help.

    Anyone have any idea how to get the category thing working?

  • #14 / Oct 15, 2012 12:24pm

    The Design Core

    359 posts

    I figured out how to do it using Playa & Low Seg2Cat.

    Would have been nice to find a way to do it without the add-ons but it’s working fine now.

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

ExpressionEngine News!

#eecms, #events, #releases