Showing only available colors on product list page
2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 1, 2008 (RSS)
This is probably answered somewhere on the forum, but I've had no luck in finding it.
My client sells products that come in different colors, however, not all colors are available for all products.
1) Next to each product’s entry on a list page I’d like to show a radio button list of the colors available for that product so that the client can order that product in that style.
I’d like to pull those available colors from a master list of all colors.
So far I’ve set up a multi record editor with a checkbox (multi value) list field containing all the colors that are offered by this manufacturer, and a checkbox list field called “available colors” for the colors available for the individual products.
In the “available colors” field’s list field options menu, I’ve played with the advanced options of “get options from database” and “get options from MySQL query”.
On the listings page, all I seem to be able to get is a text listing of all the available colors that match the items checked in the master color list, but no checkboxes.
Once that’s sorted out, I’d like to:
2) Populate the “item_name” field of a simple PayPal shopping cart form based on the color selected by the purchaser.
I hope that someone has played with this successfully and is willing to share their success.
Thanks,
Jerry
My client sells products that come in different colors, however, not all colors are available for all products.
1) Next to each product’s entry on a list page I’d like to show a radio button list of the colors available for that product so that the client can order that product in that style.
I’d like to pull those available colors from a master list of all colors.
So far I’ve set up a multi record editor with a checkbox (multi value) list field containing all the colors that are offered by this manufacturer, and a checkbox list field called “available colors” for the colors available for the individual products.
In the “available colors” field’s list field options menu, I’ve played with the advanced options of “get options from database” and “get options from MySQL query”.
On the listings page, all I seem to be able to get is a text listing of all the available colors that match the items checked in the master color list, but no checkboxes.
Once that’s sorted out, I’d like to:
2) Populate the “item_name” field of a simple PayPal shopping cart form based on the color selected by the purchaser.
I hope that someone has played with this successfully and is willing to share their success.
Thanks,
Jerry
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
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:
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.
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
interactivetools.com