Categories and Subcategories

13 posts by 6 authors in: Forums > CMS Builder
Last Post: June 21, 2010   (RSS)

By Carrie - March 10, 2009

Hi there CMSB team,

Can you please let me know the best way to achieve the following:

We have a page setup to display top-level categories (products) as a sub-menu on the left of the summary listing on the right see the page here: http://www.commandercentresydney.com.au/products.php

Currently, when you click on a sub-menu item or "more" you go to a single record page for that item. What we need it to do is to go to a multi-record page that lists the sub-categories for the selected product (e.g. "Telephone Systems has 4 or 5 sub-categories). Then when you click on "more" from this page, then you go to a single record page description.

We thought about creating a series of multi-record sections, one for each top-level product (e.g. Telephone Systems), but this would mean hard coding the sub-menu, and the client needs to be able to manage the top-level categories and sub-categories dynamically. The sub-menu DOES NOT need to display sub-categories below what is already displayed.

Your help would be much appreciated!

Thanks,

Carrie
Carrie
WebGenesis
www.webgenesis.com.au

Re: [Carrie] Categories and Subcategories

By Perchpole - March 11, 2009

Carrie -

THis is the easiest way...

Set up all your "Pages" within a single multi-category section. Then set-up another multi-category section called "Categories". Next, go back to the "Pages" section and create a list which calls the category names from the "Category" section.

This simple set-up will allow to create pages which are assigned to a specific category. You can then control the display and the access to those pages using "Where" rules.

It's far easier to set-up than trying to create a seperate multi-category section for every section on your site.

:0)

Perchpole

Re: [Carrie] Categories and Subcategories

By Dave - March 11, 2009

Hi Carrie,

How many levels of subcategories are there? Is it fixed or varied? 3 levels would be: root level, sub category, and sub category.
Dave Edis - Senior Developer
interactivetools.com

Re: [Perchpole] Categories and Subcategories

By Carrie - March 12, 2009

Thanks, I will try this tomorrow - sounds simple..

Although I may need some help with adding extra code to assign the categories once I get to this part. (I'm not really a programmer, in fact )
Carrie
WebGenesis
www.webgenesis.com.au

Re: [Dave] Categories and Subcategories

By Carrie - March 12, 2009

Dave,

The heirarchy goes like this:

Top level main navigation of site is hard coded and not part of the dynamic heirarchy. So, when you click on Products you get (for example)

Telephone Systems (top level category)
>Vendor List (sub category not visible on initial page)
>Support services (sub category not visible on initial page)
>Nortel (sub category not visible on initial page)
>Siemens (sub category not visible on initial page)
>Lake Communications (sub category not visible on initial page)
Audio & Video Conferencing (top level category)
>Another subsection (sub category not visible on initial page)
>Perhaps another one (sub category not visible on initial page)

As per the reference to the website page, http://www.commandercentresydney.com.au/products.php this page displays how we want it to look, it's just after you click on "more" where it needs to go to a multi-record page for that top level category.

Does that makes sense? Do you think Is the suggested method the easiest way to achieve this?
Carrie
WebGenesis
www.webgenesis.com.au

Re: [Carrie] Categories and Subcategories

By Carrie - March 12, 2009 - edited: March 12, 2009

OK I got excited and tried your suggestion Perchpole....

I've worked out how to add the list of categories in what we've called "Products". It is displaying the "Product Category" items we have set up. So far so good. Now I'm stuck...

Is there an example somewhere of how and where to add this code into the page so it the product categories just display call their subcategories?
Carrie
WebGenesis
www.webgenesis.com.au

Re: [Carrie] Categories and Subcategories

By Dave - March 12, 2009

Hi Carrie,

When linking categories to products, be sure to use "num" for the value field and "name or title" for the label field. Otherwise if you link on name and the category name changes it will forget all the associations.

Next, get it listing all the subcategories on the page, then add some code that uses the number of the selected main category in a where like this to only show the subcategories that have the current category as a parent.

'where' => " parentCategory = '" .getNumberFromEndOfUrl() . "'",

It's a little complicated to explain without seeing your code and knowing what fieldnames you're using. If you can attached your viewers and/or post urls that would help.

Hope that helps, let me know how far you get with it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Carrie] Categories and Subcategories

By Dave - March 13, 2009

Hi Carrie,

The attachment didn't come through, can you try again (you need to click "Upload" before "Post"). Or just email me your CMS and FTP login details to dave@interactivetools.com and I can take a look. Email, don't post login details to the forum. If it's something I can do quickly for you I will and then I'll post the relevant code back here for reference.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Perchpole] Categories and Subcategories

By chassa2556 - March 27, 2009 - edited: March 27, 2009

Carrie -

THis is the easiest way...

Set up all your "Pages" within a single multi-category section. Then set-up another multi-category section called "Categories". Next, go back to the "Pages" section and create a list which calls the category names from the "Category" section.

This simple set-up will allow to create pages which are assigned to a specific category. You can then control the display and the access to those pages using "Where" rules.

It's far easier to set-up than trying to create a seperate multi-category section for every section on your site.

:0)

Perchpole


Hi Perchpole

Is there any way you could expand on this? It sounds like a great system but how would you link this in with a category menu? So the client could then adjust the menu and still get the filtered categories showing correctly? I'm not absolutely clear which category section to edit to get it to pull in the correct filter.