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.

Subcategories or channels?

September 21, 2011 11:46am

Subscribe [2]
  • #1 / Sep 21, 2011 11:46am

    Hi,

    I’m very new to EE, and I’m on the way to finsh Michael Boyink’s Tutorial Book “Building an ExpressionEngine 2 Site”. Ok, that’s fun! But now, I’am not sure, how to implement products in my website with several hierarchies. Can someone help me, or even better, tell me, where to get more information about this?

    Here’s my hierarchie of the products:

    It’s a fashion-site and there are

    1. casual or couture products
    2. in the casual (or couture) section, there are several collections: summer 2010, winter 2010, summer 2011 etc.
    3. in the collections, there are several categories: shirt, jacket, pants…
    4. and finally in each collection, there are several products

    I should make a description-page for the casual-sector with buttons, linking to the collections in it. Then, there should be a description-page for each collection with buttons, linking to the products in it. and in the product-page, there ist just al list with the products.

    Can I handle this just with categories or do I have to mix channels and categories?


    Thanks for your help!

    [Mod Edit: Moved to the EE 2 Technical Support forum]

  • #2 / Sep 21, 2011 6:00pm

    Ok, sorry for this post. I’m really very new to EE 😊
    After two hours of research in the documentation, I think the relationships are what I’m looking for. Right?

  • #3 / Sep 21, 2011 9:43pm

    Dan Decker

    7338 posts

    mit der Maus,

    Welcome to ExpressionEngine and the Forums!

    Here is how I would handle this, and this is just my opinion. This is in no way the only way, or even necessarily the best way 😉

    I would set up 2 Channels, 1 for each of your sections. Then you can have categories for each of your collections (summer, spring, fall, winter) I wouldn’t label them with the year *because* your product entries will have a date associated with them, and you can use that to manage the yearly changes. That way you won’t have to make new categories every year, etc. You can also set up categories for your garment types, shirts, pants, jackets, etc.

    And here is the clincher, each of your product entries can be assigned more than 1 category. With that, a product can be in the Spring and Pants categories and be “dated” for 2010 with a date field in the channel.

    Does that help?

    Cheers,

  • #4 / Sep 22, 2011 9:49am

    Hi Dan

    Thanks a lot for your support! Ok, I think, i understand your proposal. The big picture is getting clearer.
    As a understand it now, EE is so flexible, that there are several ways to get my problem done. Right? Uff. Cool, but uff 😊

    Because I have text and a picture for each collection AND a product (i.e. named “t-shirt”) has some extra information too, like fabrication details, I thought, I would get it done, mostly with channels and relationship. So I will have

    a channel “Casual”
    a channel “Couture”
    on a template page like this: http://extra.mitdermaus.ch/waw/001/casual/

    a channel “Collections”
    on a template page like this: http://extra.mitdermaus.ch/waw/001/casual/positive-movement/

    a channel “Products”
    on a template page like this: http://extra.mitdermaus.ch/waw/001/casual/positive-movement/shirt-kurzarm/

    and a channel “Articles”
    wich are listed on the same template as the product.

    So the channels will have relationships on each other (causal to collections, collections to products and products to articles).

    What do you think, is this a good way? Or would it be better to use categories? Perhaps, I did not unterstand the concept of the categories right, but I think, I will have problems, if I use categories, because I will have a separate product-page (i.e. for t-shirts), on which I will have detailled information about a product (which can differ from collection to collection) and on this product, there are several articles (with different colors).

    And with my proposal for the architecture, would it be possible to have different wasy to acces the products? i.e. Can i make a function, wich shows all product over all collections which are in stock?

    Puh, there’s a storm in my head 😊

    Thanks very much! EE rocks.

  • #5 / Sep 22, 2011 12:36pm

    Oh damn, there is something wring in my head. I thought, I can make many-to-many relations form channel to channel. But as I see now, you can only make a one-to-one relationship. So I can’t connect many products to one collection, right?

  • #6 / Sep 22, 2011 8:05pm

    Dan Decker

    7338 posts

    Marco and the Mouse,

    That is correct, EE’s native relationship are one to one, but you can have “many” related to one. If that makes sense? There is an add-on that you can look at that allows for many-to-many relationships. Have a look at Playa.

    Cheers,

  • #7 / Sep 22, 2011 8:49pm

    Dan,

    Thanks again! This add-on seems to be very useful.
    I’m not sure, if I get it right: I have tried to make it done with many-to-one. I have 3 entries in my collection channel. All of them are related to one entry in the casual-channel. On this view, I have tried to implement the details (just a title an a text) of the casual-entry and a title and picture of each related collection:
    http://extra.mitdermaus.ch/waw/001/casual/

    And I did it like this:

    {embed="embeds/html_header" my_page_title="Casual"}
        
        {embed="embeds/page_header my_location="casual"}
        
        <!-- CONTENT -->
        <div class="content-bg">
            <div id="content" class="page">
    
            {exp:channel:entries channel="label" entry_id="6" disable="categories|member_data|pagination" sort="asc" limit="1" }
            <div id="article" class="halfleft">
                <h1>{label_title}</h1>
                {label_text}
        
            </div>
    
            {related_entries id="collections"}
            <div id="article" class="halfleft collection-preview">
                <a href="#">Kollektion_<strong>{collection_title}</strong>../images/casual/positive_movement.jpg</a>
            </div>
            {/related_entries}
            {/exp:channel:entries}
            <div class="clear">
            
            </div>
            
            {snp_footer}

    But that’s not working, because I can’t use a relationship in the other direction (I’ve implemented the relationship in the collection-channel). Is this correct?

  • #8 / Sep 24, 2011 4:01pm

    Dan Decker

    7338 posts

    Hi Marco and the Mouse,

    You say you are needing to draw in the entries related between the casual channel and the collections channel? In your template code above, you are calling a “label” channel here:

    {exp:channel:entries channel="label" entry_id="6" disable="categories|member_data|pagination" sort="asc" limit="1"}

    Is that the correct name of the “casual” channel you are referring to?

    Cheers,

  • #9 / Sep 24, 2011 4:50pm

    Hi Dan,

    Yes, that’s correct. I’ve made a “Label”-Channel with two entries: “Casual” and “Couture”. And I had 2 days of thinking about my architecture 😊

    There is a channel “Label”, a channel “Collections” which has a relationship to a Label-Channel (which I connect by {reverse_related_entries} ), and a channel “Products”, with several categories, like “Label”, “Collection”, “Product-Type”, “Material” etc.

    That’s because I want to have the possibility to have filtering-functions on the products for future releases (i.e. show my all shirts (in all collections), or show all products in collection “First Love” etc.). - which is based on your idea 😊 thanks for this!

    But for now, I have to connect the products to a collection. The question is: Should I connect them, by setting the same Collection-category as set in the product-entry. Or should I connect them by relationship. The problem is the filtering by category “Product-Type”. This is a category set in the product-channel. So, on the collection-detail page, i don’t want to choose, which product I wan’t to se. I want to choose, which products of a product-type of this collection I want to see (“Shirt”, “Jacket”).

    And here’s the actual code from the collection-template:

    {exp:channel:entries channel="collections" disable="categories|member_data|pagination" sort="asc" limit="1" }
    {embed="embeds/html_header" my_page_title="Casual, Kollektion: {title}"}
    {/exp:channel:entries} 
     {embed="embeds/page_header my_location="casual"}
     
     <!-- CONTENT -->
     <div class="content-bg">
      <div id="content" class="page">
    
      {exp:channel:entries channel="collections" disable="categories|member_data|pagination" sort="asc" limit="1" }
      <div id="article" class="fullsize">
       <h1>{collection_title}</h1>
       {collection_text}
     
      </div>
      
      <ul class="content-nav">
      {exp:category_sorted_entries channel="products" style="linear" show_empty="no" group_id="3" entry_id="{reverse_related_entries}{entry_id}|{/reverse_related_entries}"}
       {category}
       <li><a href="http://{url_title}/{category_url_title}" title="{category_name}">{category_name}</a></li>
       {/category}
      {/exp:category_sorted_entries}
      </ul>
      
    
      {/exp:channel:entries}
      <div class="clear">
      
      </div>
      
      {snp_footer}

    As you can see, I have problems, to get the right URL for the product-link. I have to generate a URL, which calls a new template “casual/product/” on the channel “collection” with the category which is choosen.

    Hmm, hope this is understandable.

  • #10 / Sep 24, 2011 5:35pm

    Hey, it works! Cool.
    Ok, perhaps it’s not the best solution. But it works 😊

    Here is the code of the product-template, where i show all products (of the choosen collection and category “product-type”):

    {exp:channel:entries channel="collections" disable="categories|member_data|pagination" sort="asc" limit="1" }
    {embed="embeds/html_header" my_page_title="Casual, Kollektion: {title}"}
    {/exp:channel:entries} 
     {embed="embeds/page_header my_location="casual"}
     
     <!-- CONTENT -->
     <div class="content-bg">
      <div id="content" class="page">
    
      {exp:channel:entries channel="collections" disable="categories|member_data|pagination" sort="asc" limit="1" }
      <div id="article" class="halfleft">
       <h1>{collection_title}</h1>
     
      </div>
    
      <div class="clear"></div>
      
      <div id="showroom">
      {reverse_related_entries}
       <div id="product">
        {product_picture}
       </div>
      {/reverse_related_entries}
      </div>
      
    
      {/exp:channel:entries}
      <div class="clear">
      
      </div>
      
      {snp_footer}

    Update:Works with Add-on Category Sorted Entries: category-sorted-entries

  • #11 / Sep 26, 2011 5:48pm

    Dan Decker

    7338 posts

    Hi Marco and the Mouse,

    Congratulations! I’m happy to see you were able to be successful. One of the best features of ExpressionEngine is that there is no “best way”, there are many solutions and way to do things. The important thing is to find the method that achieves the results you are happy with 😊

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases