Category issue

6 posts by 3 authors in: Forums > CMS Builder
Last Post: February 2, 2010   (RSS)

Ok bear with me here and I will try and explain this as best I can.

We are building a website for a wine distributor. they have one section called producers which when clicked brings you to a list page that shows all the producers logos with a short description. When the user clicks on a specific producer they are brought to a details page where it displays a full description with various details about that specific producer.

Pretty straight forward so far.

Now when the user is on the producers detail page we also want to see a list of wines that are associated to that specific producer. if a wine has been selected from that list they will then be brought to another detail page for that specific wine with all its details.

so in essence there would be a multi list section or category section for the producers with a detail page for each producer and then another multi section or category section for the list of wines.

Our problem is that we don't know how to associate the wine list to the producer so that when the producers detail page is brought up it will show a list of wines associated to that particular producer.

Is there a way that two different sections can be linked or associated with one another. Maybe you guys have another solution for us.

I really hope that I am explaining my self clearly.

Re: [Dan Maitland] Category issue

By flamerz - January 30, 2010 - edited: January 30, 2010

I think you can do a wines table (category type), and insert a pulldown multivalue field in your multicategory table of wine distributors to set eachwine that producer has.

in the multicategory set "get options from database", database "wines", option values: num and option labels: name.

You have a nice tutorial about categories in this forum.

wine producers
title textfield
Content wysiwyg
Wines (ctrl+clic) list *

wines
title textfield
Content wysiwyg

* this one set as multicategory

Re: [Dan Maitland] Category issue

Ok so I am able to set it up so that I can have a list menu in appear when creating a new wine record and it will let me choose any producer that I have already entered. Great.

But what I don't get is how do I now create a details page for a producer and have it also show only the wines that are associated to that particular producer. I know it must be possible but I just don't see it. Please if anyone can give me a more detailed explanation it would be greatly appreciated.

Re: [Dan Maitland] Category issue

Please, can someone help me to get this working. The site I'm building depends on this small but important function.

Re: [Dan Maitland] Category issue

By flamerz - February 1, 2010

Hi again.

in your details page you will have the wine producer and his wines.

you can generate the wines list from the cms.

but, to show each wine and its details, you have to load this way:

$winearray = getListValues('producers', 'wine', $producersRecord['wine']);
$wineascsv = join(', ', $winearray);

list($winesRecords, $winesMetaData) = getRecords(array(
'tableName' => 'wines',
'where' => "num in (0, $wineascsv)",
));

first is get the tab separated field and convert to comma separated values, and second is assemble the query.

after this you can echo it:

<?php foreach ($winesRecords as $record): ?>
Name: <?php echo $record['name'] ?><br/>
Content: <?php echo $record['content'] ?><br/>

<?php endforeach ?>


i hope you can get the way to do, sorry if i did some bug in the code. (i hope not, but im traveling and just writing from my small laptop in hotel). [pirate]