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

January 08, 2012 9:13pm

Subscribe [2]
  • #1 / Jan 08, 2012 9:13pm

    dominickelly

    179 posts

    Hi all,

    I’ve recently purchased Carthrob and I’m pretty proficient with EE2 after building around 10 sites in it. One thing that’s always bugged me about EE is category management - basically IMO category handling in EE is utterly dreadful.

    Can you guys let me know how you handle categories in EE?

    The e-commerce site I’m building is going to have an unknown number of categories, and sub-categories. So for example:

    Cat 1
    Cat 2
    |———Sub Cat 1
    |———Sub Cat 2
    Cat 3

    When clicking on Cat 1 and Cat 3 I want to display a list of products.
    When clicking on Cat 2 I want to display Sub Cat and Sub Cat 2, but no products
    When clicking on Sub Cat 1 or Sub Cat 2 I want to display products.

    I want to give my client the ability to setup any category structure they like, ideally using EE’s Categories module.

    However, I’ve found this mind-bendingly problematic for such a ridiculously easy and common website structure. It seems that at every point EE somehow finds an technical issue with hierarchal data, be it parse order, lack of tags or something else - content just does not want to be structured in any real or meaningful way.

    I’m considering buying Structure to handle categories to save my sanity… However, that means products can only belong in one category, which is equally terrible as an e-commerce solution.

    Any help would be greatly appreciated.

    Dom

  • #2 / Jan 09, 2012 9:52am

    zizther

    228 posts

    I don’t find EE’s categories any more difficult than other CMS’s categories. I think you just have to think how you are going to set them up and use them.

    I would setup the parent categories and then subcategories, you can then use conditionals to see if the parent categories have sub categories, if they do then with JS you can show the dropdown (the JS can check for a child <ul> or a certain class).

    This way if there are sub categories you can get the parent category to just show the list rather than going to a URL, and if they don’t it just goes to a URL.

    This should give you the flexibility to allow your client to manage the categories.

  • #3 / Jan 09, 2012 9:58am

    dominickelly

    179 posts

    “use conditionals to see if the parent categories have sub categories”

    I’d love to know how to do this, as I couldn’t get this working.

    “if they do then with JS you can show the dropdown”

    Actually, the drop down isn’t the issue. I want to display category images in the main page as thumbnails.

  • #4 / Jan 09, 2012 11:19am

    zizther

    228 posts

    There are lots of add-ons for categories that would be worth looking at, not sure if there is one that fits your needs.

    Maybe you could use a query to select the sub categories, something like:

    {exp:query sql="SELECT cat_id as category_id, cat_name AS category_name FROM exp_categories WHERE parent_id != 0"}
        <a href="http://{path=category/C{category_id/}}">{category_name}</a>
    {/exp:query}


    Not sure about your second point.

  • #5 / Jan 09, 2012 11:24am

    dominickelly

    179 posts

    I’ve tried various plugins and non of them seem to do what I want:

    if(has subcats){
    print subcats
    }else{
    print products
    }

    I don’t think your example will work if there are sub-sub categories as sub categories will have parents?

  • #6 / Jan 09, 2012 12:12pm

    zizther

    228 posts

    There is not much more i know on this, hopefully someone with more experience will chip in.

  • #7 / Jan 09, 2012 11:29pm

    John Henry Donovan

    12339 posts

    Hi zizther,


    You might have more success with a category plugin to give you some more flexibility. Take a look at EE2 Child Categories . It might do what you wish

  • #8 / Jan 10, 2012 6:14pm

    zizther

    228 posts

    Just came across this, maybe useful http://devot-ee.com/add-ons/gwcode-haschildren

  • #9 / Jan 13, 2012 1:54am

    John Henry Donovan

    12339 posts

    Let us know how you get on with our suggestions Dominic. For now I’m going to move this thread into Community Help to give you some time to try out some things.

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

ExpressionEngine News!

#eecms, #events, #releases