Show sub types in navigation with linked lists

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 8, 2009   (RSS)

By benedict - December 7, 2009

Hi guys,

I am using a category >> sub category method of presenting products using for a lawnmower retailer.

I am not using category sections, instead I have created a product_category and product_sub_category section, and then a product table that when the user selects a product_category, the product_sub_category list autopopulates in the backend (I followed a thread on your forum doing this with Countries and States which I have used on another site successfully).

So the backend is working fine.

With the front end, I am trying to work out the best way to do the navigation. One way is to hard code the categories (not ideal), but I don't now how to show the sub categories.

What would be ideal (and may require some custom work for you guys to do) is that the product_categories are listed on the home page, and when a user selects the category, the product page is presented and the navigation now shows that category expanded to show sub-categories (and also shows all the products).

The old site shows this being executed (see http://www.dawnmowersonline.com.au/products.php?category=2 as an example), so if we can reproduce this, that would be good.

Thanks in advance. I have attached files for your perusal.

Cheers,

B
Attachments:

archive.zip 6K

Re: [benedict] Show sub types in navigation with linked lists

By Chris - December 8, 2009

Hi benedict,

So right now, you've got your categories hard-coded?

<ul class="side-nav">
<li><a href="products.php?product_type=Accessories">Accessories</a></li>
<li><a href="products.php?product_type=Axes">Axes</a></li>
<li><a href="products.php?product_type=Blowers">Blowers</a></li>
<li><a href="products.php?product_type=Brush Cutters - Line Trimmers">Brush Cutters - Line Trimmers</a></li>
<li><a href="products.php?product_type=Chain Saws">Chain Saws</a></li>
<li><a href="products.php?product_type=Construction Equipment">Construction Equipment</a></li>
<li><a href="products.php?product_sub_type=Generators">Generators</a></li>
<li><a href="products.php?product_type=Hand Tools&product_sub_type=Gloves">Gloves</a></li>
<li><a href="products.php?product_type=Hand Tools">Hand Tools</a></li>
<li><a href="products.php?product_sub_type=Hedge Trimmers">Hedge Trimmers</a></li>
<li><a href="products.php?product_type=Mowers">Mowers</a></li>
<li><a href="products.php?product_type=Blowers">Mulchers - Chipper Choppers</a></li>
<li><a href="products.php?product_sub_type=Pumps">Pumps</a></li>
<li><a href="products.php?product_type= Tillers - Rotary Hoe">Tillers/Rotary Hoe</a></li>
<li><a href="products.php?product_type=Toro Trax and Mini Diggers">Toro Trax and Mini Diggers</a></li>
</ul>


And you want to list them dynamically -- only listing the sub-categories of a selected category?

To figure this out, we'd need to know how your sections are configured (i.e. their names and their fields' names). We'd also need to know how the relationships between your sections work (I noticed that in your hardcoded list I've duplicated above, you're not using record numbers in the query strings -- this is entirely possible, but can be a little trickier to set up.) Please post your details and I'll take a look.

Alternately, we can quickly get this working for you through our consulting service. Please let me know if you're interested in that.
All the best,
Chris

Re: [chris] Show sub types in navigation with linked lists

By benedict - December 8, 2009

OK:

1. we have a product_types section with one field: product_types (text field)

2. we have a product_sub_types section with two fields: product_types (list that looks up product_types) and product_sub_types (text field)

3. We have a products section with the following fields:

product_name
product_type
product_sub_type
brand
description
hidden

product_type is a list field that pulls it values from product_types
product_sub_type is a list field that uses the "get options from MYSQL query (advanced)" option with this query:

SELECT product_sub_types, product_sub_types FROM cms_product_sub_types WHERE product_types = '<?php echo $ESCAPED_FILTER_VALUE ?>'

Now that I've written that all out, to hell with that. Can you guys do it with consulting? Send me the quote and I'll shoot through the access details.

Cheers,

Benedict

Re: [benedict] Show sub types in navigation with linked lists

By Chris - December 8, 2009

Hi benedict,

I've sent you an email.
All the best,
Chris