Setting up categories, subcategories and records

6 posts by 3 authors in: Forums > CMS Builder
Last Post: August 16, 2011   (RSS)

By coliva - August 12, 2011

Hi CMS team,

What is the best way to set up my page structure in CMSB for a site that is 3 levels deep? And then how do I set up the category menu in order to create a nav menu?

Our site will consist of:

Level 1 - Product Category sections - (ie, Cheeses)
- Level 2 - Brand sections (ie, Kraft)
- Level 3 - Individual product pages

We would like the Product Category sections to list all the brands and their related product links. The Brand sections would list the individual product links, and we'd also like to include (at the top of the page) a brand image and brand description, managed by CMSB.

I created multi-record section editors for each of the product categories: Cheeses, Sauces, Olis & Vinegars. These editors includes the fields: title, content, brand image and category (list). I then created records for each of the brands under the respective categories.

I also created multi-record section editors for each of the brands. These editors include the fields: title, content, category (list), image (upload).

I created a category menu group with the correct site hierarchy, and specified these categories within each of the records created for the brands above.

I've searched through numerous posts on how to bring this all together but haven't found a simple answer. Could you please either point me to the correct post or lend some insight into how to correctly set up the structure and link the pages together? I would greatly appreciate it.

Thank you in advance!
Claudia

Re: [Jason] Setting up categories, subcategories and records

By coliva - August 15, 2011

Thank you so much Jason. Yes, the structure is as you stated. I will try this solution out and let you know if I have any other questions.

Re: [coliva] Setting up categories, subcategories and records

By coliva - August 15, 2011

Hi Jason,

I'm working on nesting the list or records from my brandList viewer into my product_categoryDetail page, but wanted to know how to limit the list so that only the brands that pertain to the selected product category display. I'm sure it involves an IF statement and the values of the pulldown lists, but i'm not certain how to write this out. Could you help me here please?

The same would apply for nesting the list of records from my productsList viewer into my brandDetail page.

I read the post by Chris describing how to set up a categories list to show the records, but in my case i'm not using a category menu item but instead just the records lists.

Here's what my code looks like:

// load records
list($product_categoriesRecords, $product_categoriesMetaData) = getRecords(array(
'tableName' => 'product_categories',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));

list($brandsRecords, $brandsMetaData) = getRecords(array(
'tableName' => 'brands',
));

$product_categoriesRecord = @$product_categoriesRecords[0]; // get first record


And how I'm displaying the records:
<h1><?php echo $product_categoriesRecord['title'] ?></h1>

<?php foreach ($brandsRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php endforeach ?>

Re: [coliva] Setting up categories, subcategories and records

By coliva - August 16, 2011

I figured out how to write the condition to only show only the links pertaining to the selected brand within the detail page:

<h1><?php echo $product_categoriesRecord['title'] ?></h1>

<?php foreach ($brandsRecords as $record): ?>
<?php if ($record['product_category'] == (int)$product_categoriesRecord['num']): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php endif ?>

<?php endforeach ?>

[:)]

Re: [coliva] Setting up categories, subcategories and records

By ross - August 16, 2011

Hi Coliva

Thanks for the update! Glad to hear you got that going. Keep us up to date with how you are making out. Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/