Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best practice for working with Categories in ExpressinEngine?

I'm working on my first eCommerce site using the "store module". We have around 25 categories that each product can be categorized by. This is my first time working with so many categories.

Most of the product selection area will be using one template. I have a couple of questions regarding the use of categories. I will list them below. Any insight into what the best approach is, would be most appreciated. I'm not even sure If i'm doing this correctly. I'm kinda of fumbling my way through this one. LOL.

Question 1

When I create links for each of the parent categories (ie. Central Vacs, Portable vacs, etc.), should I be using the URL to call on the category to display product in this category or is there a dynamic way of creating the links?

Question 2

If you have selected a parent category (ie. Central Vacs, Portable vacs, etc.) I would like all child categories of this group to be displayed in the side menu (ie. Power, colour, etc.). Is the best way to achieve this done by using the URL segment to show the child categories?

I really want to make sure that if a user is displaying "Portable Vacuums" that all of the side menu navigation is related to that category only (ie. display child categories for this Parent)

Thanks in advance

like image 452
Mark Dodgson Avatar asked Oct 27 '12 16:10

Mark Dodgson


1 Answers

Question 1. When I create links for each of the parent categories (ie. Central Vacs, Portable vacs, etc.), should I be using the URL to call on the category to display product in this category or is there a dynamic way of creating the links?

Yes, and there are a variety of ways to dynamically build a linked list of categories. One way is the native Channel Categories Tag

The {category_url_title} and {category_id} variables available within the Channel Categories tag pair can also be useful in building URLs for links.

Alternatively, GWcode Categories is a handy plugin for working with categories and has lots of useful options.

Question 2. If you have selected a parent category (ie. Central Vacs, Portable vacs, etc.) I would like all child categories of this group to be displayed in the side menu (ie. Power, colour, etc.). Is the best way to achieve this done by using the URL segment to show the child categories?

Yes. I'd recommend using a segment containing the category_id or category_url_title as a parameter in GWcode Categories to get the list of children. GWcode Categories has excellent documentation. A basic example:

{exp:gwcode_categories cat_url_title="{segment_3}"}
    {cat_name}      
{/exp:gwcode_categories}            

Another really useful add-on for working with categories is Low Seg2Cat

like image 100
Alex Kendrick Avatar answered Sep 23 '22 04:09

Alex Kendrick