Big Question
5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 31, 2010 (RSS)
Ok I have a big question. So I am creating this website for a wine distributor. They will have one multi section for wines where they will enter in all their wines with the info that goes along with it like Name, description, year, vintage, price, PRODUCER etc...
Then they will have another multi section for PRODUCERS with all the info required like Name, description, region, logo etc.... Now they won't have a detail page for the wine just a list and the Producers section will have both a list of producers and their respective details page. Now the big question is, when entering in a new wine is there a way that the user can select a producer from some sort of list so that on the PRODUCERS details page along with all the PRODUCER'S info we can display all the wines that are linked to that specific PRODUCER.
I really hope that I am being clear enough. I have a decent grasp of CMS Builder but am by no means a PHP master. Is there a semi simple way of doing this or some sort of work around. I have already used Chris's elatedlookup plugin and have acheived 90% of what I needed it to do but was wondering if there is another way to get this to work or if Chris's plugin can help me with this project.
Then they will have another multi section for PRODUCERS with all the info required like Name, description, region, logo etc.... Now they won't have a detail page for the wine just a list and the Producers section will have both a list of producers and their respective details page. Now the big question is, when entering in a new wine is there a way that the user can select a producer from some sort of list so that on the PRODUCERS details page along with all the PRODUCER'S info we can display all the wines that are linked to that specific PRODUCER.
I really hope that I am being clear enough. I have a decent grasp of CMS Builder but am by no means a PHP master. Is there a semi simple way of doing this or some sort of work around. I have already used Chris's elatedlookup plugin and have acheived 90% of what I needed it to do but was wondering if there is another way to get this to work or if Chris's plugin can help me with this project.
Re: [Dan Maitland] Big Question
By Jason - March 30, 2010
Hi Dan,
One way to do this is to add a field in the "wine" section called producer. Make it a list field. Under list options, select "Get options for database". Select you "producers" table, select "num" for the values, and "title" for the labels.
Now when you go to add a wine to the wine section, there will be a dropdown with all producers.
Finally, in your Producer list or display page, you can use the following code to display all the wines they are associated with:
You'll have to adjust the names based on how you've named things. But this will list the wines associated with a given producer.
Let me know if that helps.
One way to do this is to add a field in the "wine" section called producer. Make it a list field. Under list options, select "Get options for database". Select you "producers" table, select "num" for the values, and "title" for the labels.
Now when you go to add a wine to the wine section, there will be a dropdown with all producers.
Finally, in your Producer list or display page, you can use the following code to display all the wines they are associated with:
<?php
list($wineRecords,$wineMetaData)= getRecords(array(
'tableName' => 'wine',
'where' => 'producer='.$record['num']
))
?>
<?php foreach($wineRecords as $wine): ?>
<?php echo $wine['title'] ?>,<?php echo $wine['year'] ?><br />
<?php endforeach ?>
You'll have to adjust the names based on how you've named things. But this will list the wines associated with a given producer.
Let me know if that helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Big Question
Jason,
Are you sure there isn't supposed to be an if statement in there somewhere? From the looks of the code I think that will just call all wines and not just the ones associated through the list. I could definitely be wrong but it just doesn't look right for some reason.
Are you sure there isn't supposed to be an if statement in there somewhere? From the looks of the code I think that will just call all wines and not just the ones associated through the list. I could definitely be wrong but it just doesn't look right for some reason.
Re: [Dan Maitland] Big Question
By Jason - March 31, 2010
Hi Dan,
This code should work. You would put it right where you want the wines of a producer listed. The line: " 'where' => 'producer='.$record['num'] " means that it will only take wine records from the database that have a producer field that is the same as the current producer that is being printed out.
Give it a try and let me know if there are any problems.
This code should work. You would put it right where you want the wines of a producer listed. The line: " 'where' => 'producer='.$record['num'] " means that it will only take wine records from the database that have a producer field that is the same as the current producer that is being printed out.
Give it a try and let me know if there are any problems.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Big Question
KILLER!! I'll try it out and let you know. Thanks J.