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 and navigation structure

April 23, 2012 11:01am

Subscribe [4]
  • #1 / Apr 23, 2012 11:01am

    jmorin

    1 posts

    I’ve read dozens of posts that almost address bits of what I am trying to figure it out, but I have been unable to piece it all together.

    In my main navigation I want a dropdown menu for ‘Products’. The products are divided into categories and subcategories. I only want to show the parent categories in the navigation. I guess I can do this by specifically listing the parent category ID’s.

    Clicking on one of the parent categories links to its respective category page. On each category page, I want a list of that category’s children in the sidebar. Rolling over the sub-categories should generate a fly-out menu showing the entries associated with that sub-category. This menu needs to be generated automatically based on the parent category for that page. I’ve looked at the Channel Category Archive Tag, but it doesn’t seem to be quite the right solution.

    This sort of navigation structure should be possible, right?

    And lastly, I haven’t been able to find whether categories can have the same name. So for example, can I have a category called ‘DVD’ with sub-categories of ‘Comedy’, ‘Drama’ etc. and then a category of ‘Blu-Ray’ with the same sub-categories of ‘Comedy’, ‘Drama’ ?

  • #2 / Apr 25, 2012 7:15am

    John St-Amand

    865 posts

    In my main navigation I want a dropdown menu for ‘Products’. The products are divided into categories and subcategories. I only want to show the parent categories in the navigation. I guess I can do this by specifically listing the parent category ID’s.

     

    Actually, there’s a “parent_only” parameter when displaying your categories, so you should be able to use this to limit them.

    Clicking on one of the parent categories links to its respective category page. On each category page, I want a list of that category’s children in the sidebar.

     

    Nested categories are a bit tricky in EE sometimes, but you can accomplish this various ways, including using some great category-related add-ons available from devot-ee.com.  First order of business would be to be able to display the set of categories you want within a nested unordered list showing all categories.

    Rolling over the sub-categories should generate a fly-out menu showing the entries associated with that sub-category. This menu needs to be generated automatically based on the parent category for that page. I’ve looked at the Channel Category Archive Tag, but it doesn’t seem to be quite the right solution.

     

    Once you have your main list of categories with children nested within your unordered list, the stylistic approach is then a matter of CSS and possibly jquery, so not something handled by EE but by code you “wrap around” your categories list.

    And lastly, I haven’t been able to find whether categories can have the same name. So for example, can I have a category called ‘DVD’ with sub-categories of ‘Comedy’, ‘Drama’ etc. and then a category of ‘Blu-Ray’ with the same sub-categories of ‘Comedy’, ‘Drama’ ?

     

    Yeah, here’s where you would run into some issues - EE does require category url titles to be unique - not the “name” just the URL title.  So you can get around this by simply actively controlling your category url titles.  And that’s because EE uses the category url title to determine what entries to show.  There are ways around this - namely NOT using the actual category functionality and instead using an entries loop with a category condition that is fed by a segment-based lookup of the category ID (I’ve done this before to provide the kind of recursive parent-child relationship you are looking for and avoid the conflict of categories with the same name).  That starts to get a bit complicated though and does rely on a few add-ons to make it happen.  If you can instead add a parent category prefix to the subcategory URL title, you’d probably get around it ok.

    Hope that helps. Cheers.

     

  • #3 / Apr 25, 2012 12:37pm

    jmorin

    1 posts

    Thanks very much. This will be my first go with EE and I’m still in the planning phase, gathering information to try and figure out what I can and can’t do. Your response was helpful!

  • #4 / Jul 05, 2012 12:41am

    superbiaweb

    26 posts

    Hi John,

    Sorry I know this is an old thread but I was wondering how you got around the requirement for the unique URL title in the control panel? I’d love to have child categories that are unique to their parent category but not completely unique if that makes sense. I can rollup my sleeves and make it work on the front-end but aren’t sure about how to achieve it in the control panel. I guess I could setup the categories manually in the database…

    Cheers,

    Dylan

  • #5 / Jul 05, 2012 7:08am

    John St-Amand

    865 posts

    Hi superbiaweb. That I’m aware of, there is no way around the EE requirement for the category url title to be unique within the category group, regardless of parent/child relationships.  As long as two categories with the same name are in the same group, the resulting display of entries will display both sets together (which I’m sure is not what you want).  I faced this on a project recently and there is no way around it that I’ve learned about thus far.  The category name can be the same, but not the category url title.  Think of category url titles as being like entry url titles - within the same channel, they really need to be unique to avoid overlap.

    HOWEVER - with that said, I have done some work with categories using a combination of add-ons Seg2cat and Category Info wherein I wanted to actually have parent/child/subchild, etc. visible in the url segments, therein using the segments as dynamic parameters in the entries loop.  I haven’t given it a ton of thought, but I could imagine a way to minimize or eliminate the category_url caused overlap in that same way, feeding parent and child category info into the entries loop to ensure you get only the entries you are actually looking for within a child category that has the same category url title as another (or perhaps it won’t matter and EE will still not successfully distinguish between the two).  It might be worth taking a run at it that way though.

  • #6 / Jul 05, 2012 9:04pm

    superbiaweb

    26 posts

    Hi John,

    Thanks for taking the time to get back to me. Mm that’s what I thought. I might try and do things another way before resorting to making the URL titles the same.

    Cheers,

    Dylan

  • #7 / Nov 02, 2012 2:53pm

    dodgson

    120 posts

    Hi John, I know this is a really old thread, but I have a questions for you if you have time. I have a parent category with 8 child categories. I also have another category of brands. Is there a way to show all brands in a list that related to the product group selected. WOW, I hope that made sense.

    Here’s an example…

    I have a couple of products that have a parent category selected of “Central Vacuums”.

    The products are also in the “Accessories” and “Tool Kits” categories, which are children of “Central Vacuums”.

    Each product has been tagged with a different brand (ie. “BEAM”, “Electrolux”, “Dyson”)

    Is there a way to only show “BEAM”, “Electrolux”, “Dyson” in the Brand list when in the “Central Vacuums” product section because these are brands that have been selected within products in “Central Vacuums”. There are dozens of brands, but many of the brands have nothing to do with Central Vacuums.

    Very confusing. I apologize. Any suggestions would be most appreciated. Thanks

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

ExpressionEngine News!

#eecms, #events, #releases