Showing only available colors on product list page

2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 1, 2008   (RSS)

Re: [gkornbluth] Showing only available colors on product list page

By Dave - December 1, 2008

Hi Jerry,

So you have everything setup on the admin editor? You just need to colors to display on the website?

To loop over the selected colors you can use something like this:

<?php
$tablename = "products"
$fieldname = "colors";
$fieldValue = $record['colors'];
$selectedColors = getListValues($tablename, $fieldname, $fieldValue);
?>

<?php foreach ($selectedColors as $color): ?>
Color: <?php echo $color ?><br/>
<?php endforeach ?>


Then figure out the checkbox code separately in a plain html file. Once you have a mockup of the checkbox code you want you can figure out how to reproduce it with CMS Builder. Note that it will probably be easier to use radios as you probably don't want someone selecting more than one color.

Give it a try and let me know how far you get.
Dave Edis - Senior Developer
interactivetools.com