Search Display from DropDown

15 posts by 4 authors in: Forums > CMS Builder
Last Post: October 11, 2010   (RSS)

By Chris - September 12, 2010

Hi sublmnl,

Oops, there's an option for getRecords() that makes things even simpler. You can replace this:

if (sizeof($_REQUEST) == 0) {
$find_a_retailerRecords = array();
}
else {
list($find_a_retailerRecords,) = getRecords(array(
'tableName' => 'find_a_retailer',
));
}


...with this:

list($find_a_retailerRecords,) = getRecords(array(
'tableName' => 'find_a_retailer',
'requireSearchMatch' => true,
));


I learn something new every day! :)
All the best,
Chris
yup. Thanks Chris.
The option/select form works now where it groups the entries under one state and in alpha order too.

Thanks!

One thing I haven't nailed down yet is how to reset the search options to show all the states again.

Now lets say you pick CA it will show the results for CA but once the 'foreach' renders, the option/select form only shows CA as an option.

I understand why because that was the only one requested.... but hmnnnnn
Might put a page reload link on there for now until I get that nailed down.

Re: [sublmnl] Search Display from DropDown

By Chris - September 13, 2010

Hi sublmnl,

Oops! Try changing this setting to false:

// load records
list($all_find_a_retailerRecords, $all_find_a_retailerMetaData) = getRecords(array(
'tableName' => 'find_a_retailer',
'allowSearch' => false,
'loadUploads' => '0',
'orderBy' => 'state',
));


Does that help?
All the best,
Chris
B-I-N-G-O
[cool]

Re: [sublmnl] Search Display from DropDown

By sublmnl - October 11, 2010

one more thing I found I wanted to share:

I was looking for a way to display an icon/image next to the listing if the retailer had a particular amenity.

well looking through the threads I found this:

http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/Tracking_clicks_P83753/gforum.cgi?post=79115

So set up some checkboxes, uploaded the images.
Now all the client has to do is check the boxes in the CMS and the icon/image will display in the listing.

so now my code for the output looks like this:

<?php foreach ($find_a_retailerRecords as $record): ?>
<?php if ($record['amenity_1']): ?><img src="/images/icon_one.gif" alt="number 1 icon" /><?php endif ?>
<?php if ($record['amenity_2']): ?><img src="/images/icon_two.gif" alt="number 2 icon" /><?php endif ?>

<p><?php echo $record['title'] ?><br />
<?php echo $record['address'] ?><br />
<?php echo $record['city_state_zip'] ?><br />
<?php echo $record['phone'] ?><br />
<a href="http://<?php echo $record['web_site'] ?>" target="_blank"><?php echo $record['web_site'] ?></a></p><hr/>
<?php endforeach ?>


of course I replaced the real names for the fields and prettied it up some more than this but really this should get you going.
Glad to share and thanks for the help fellas.