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 Driven Menu

November 21, 2012 3:42am

Subscribe [3]
  • #1 / Nov 21, 2012 3:42am

    Scott Harrington

    85 posts

    Hi all, quite a common problem I seem to face when working with multiple entries in EE. I’m building a store with around 200 - 300 items, which I have split in to category groups so I can order them in to both product type and brand.

    There a total of 6 product types (category group 1) and 29 brands (category group 2) with some brands offering all of the 6 product ranges, some offering 3 or 4 and a handful just specialising in the one.

    I wish to make the navigation of the items as simple and effective as possible and I have decided to make the primary navigation focusing on the product categorys and push the relevant entries into a template named ‘products’ - below is what I’m using to generate the navigation, which works fine.

    <nav id="primary-navigation">
    <ul>
    {exp:channel:categories channel="products" style="linear" category_group="1" show_empty="yes"}<li><a href="/product/category/{category_url_title}" title="Shop for {category_name}" class="board-rollover">{category_name}</a></li>{/exp:channel:categories}
    </ul> 
    </nav>

    Using this method it will group all the entries from within the category group and also lists all the brands from the other category too.

    What I’m looking to do is to refine the search and create a secondary (sub) navigation that further allows to filter further down for items still within the selected product group but then further grouped by brand too….Im envisaging a secondary navigation menu listing only the brands that have the initial product in their inventory?

    I have been racking my brains on this to try and find a suitable solution and would appreciate any assistance.

    Thanks

  • #2 / Nov 21, 2012 10:51pm

    JimmyJ

    22 posts

    I’ve hit the same problem as you. I can’t seem to filter properly. I’m using GWcode Categories and Freebie right now to try and get it working. But I’ve also hit a problem with it showing all categories regardless if they exist for the list of products.

    For example, my code to show the products by 2 categories is:

    {exp:channel:entries 
                        channel="products|store_packages"
                        limit="20"
                        dynamic="off"
                        orderby="{freebie_3}"
                        sort="{freebie_4}"
                        category="{exp:freebie:category_id segment='1'}&{exp:freebie:category_id segment='2'}"
                        disable="member_data"
                        parse="inward"
                        paginate="both"}
    
    
                            
                        {template.product}
                                
    
                        
                        
                {/exp:channel:entries}

    My menu code looks like this

    <!-- Category List -->
       <ul class="category-menu" id="category">
                           {exp:gwcode_categories group_id="1" cat_url_title="{last_segment}" style="linear" entry_count="yes" show_empty="no"}
                                    <li><a href="/{complete_path}">{cat_name}</a> ({entry_count})</li>
                           {/exp:gwcode_categories}
                            </ul>
                            
                            <h4>Brands</h4>
    <p>                        <ul class="category-menu" id="brands"><br />
                           {exp:gwcode_categories group_id="2" depth="1" style="linear" entry_count="yes" show_empty="no"}<br />
                                    <li><a href="/{segment_1}/{complete_path}">{cat_name}</a> ({entry_count})</li><br />
                           {/exp:gwcode_categories}<br />
                            </ul><br />
                            <br />
                            </p><h4>Ages</h4>
    <p>                        <ul class="category-menu" id="age"><br />
                           {exp:gwcode_categories group_id="3" depth="1" style="linear" entry_count="yes" show_empty="no"}<br />
                                    <li><a href="/{segment_1}/{complete_path}">{cat_name}</a> ({entry_count})</li><br />
                           {/exp:gwcode_categories}<br />
                            </ul><br />
                            <br />
                            </p><h4>Colour</h4>
    <p>                        <ul class="category-menu" id="colour"><br />
                           {exp:gwcode_categories group_id="6" depth="1" style="linear" entry_count="yes" show_empty="no" custom_fields="yes"}<br />
                                    <li><a href="/{segment_1}/{complete_path}">{cat_name}</a> ({entry_count})</li><br />
                           {/exp:gwcode_categories}<br />
                            </ul><br />
                            <br />
                            </p><h4>Gender</h4>
    <p>                        <ul class="category-menu" id="gender"><br />
                           {exp:gwcode_categories group_id="4" depth="1" style="linear" entry_count="yes" show_empty="no"}<br />
                                    <li><a href="/{segment_1}/{complete_path}">{cat_name}</a> ({entry_count})</li><br />
                           {/exp:gwcode_categories}<br />
                            </ul>

    That seems to work for mixing 2 categories (with paging, ordering), but it’s just doing more than 2, maybe with other options such as size/color etc, and showing only categories that exist for the currently showing products.

  • #3 / Nov 22, 2012 8:30am

    Sender Scroll

    2 posts

    Thanks for sharing ... Im completely stumped, hit a dead end and not sure what to do next really ;(

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

ExpressionEngine News!

#eecms, #events, #releases