3 posts by 1 authors in: Forums > CMS Builder
Last Post: January 15, 2013   (RSS)

By weblm - January 9, 2013

I have a section in my admin that pulls Pricing Seasons from another table.  I do this in the list field as it's set to a dropdown using:

Get options from database (advanced)
Section Tablename: pricing_seasons
Use this field for option values: value
Use this field for option labels: title

The pricing_seasons seciton is a multi record section that has entires like this:

Title: Low Season
Value low_season
Dates:  a wysiwyg field listing the dates for this season

Title: Christmas
Value: christmas
Dates:  a wysiwyg field listing the dates for this season

This is working perfectly to add pricing to my properties.....the only issue is.....we might have a property that has it's own Christmas season, but the dates are different.

What I thought about doing is, in the pricing_seasons section, adding a Note field to the admin.  This would allow someone to create a new section like this:

Title: Christmas
Value: christmas_propertytwo
Dates:  a wysiwyg field listing the dates for this season
Note: Only used for Property 2

The only issue with this is.....in the actual Pricing section, the dropdown shown shows 2 Christmas entries (because they are supposed to be the same name)....but I can't tell which is which.

Is is possible through the advanced Get options from MySQL query....to be able to have the dropdown in the Pricing section show the Title - Note?

So the dropdown would look like this:

Low Season
Christmas
Christmas - Only used for Property 2

Thanks for any help!

-Kevin

By weblm - January 9, 2013

Figured it out....well actually Deborah did  ;-)  I referenced this thread:

http://www.interactivetools.com/forum/forum-posts.php?postNum=2210978#post2210978

I had to change it from CONCAT to CONCAT_WS to handle the null value of my note field.  

Here's my final query:

SELECT value, CONCAT_WS(" - ",title,note)
FROM `<?php echo $TABLE_PREFIX ?>pricing_seasons`

Hope this can help others.

-Kevin