cmc-sales/views/products/get_product_options.ctp
2011-01-11 19:52:52 +11:00

48 lines
1.2 KiB
PHP
Executable file

<?
foreach ($options as $opt) {
$default_option = '';
foreach($opt['ProductOption'] as $prodopt) {
/* Make it the default selected if it's the default option
* Logic that enforces only 1 default option to be added to the product_options controller
*/
if($prodopt['model_number'] != null) {
$drop_options[$prodopt['id']] = $prodopt['model_number'].": ".$prodopt['title'];
}
else {
$drop_options[$prodopt['id']] = $prodopt['title'];
}
if($prodopt['default'] == 1) {
$default_option = $prodopt['id'];
$drop_options[$prodopt['id']] .= " (Default)";
}
}
/**
* If it's an exclusive category, display a drop down box. Otherwise, check boxes
*/
if($opt['ProductOptionsCategory']['exclusive'] == 1) {
echo $form->input('ProductOption.'.$opt['ProductOptionsCategory']['name'],
array('label' => $opt['ProductOptionsCategory']['name'],
'options' => $drop_options, 'default' => $default_option));
}
else {
echo $form->input($opt['ProductOptionsCategory']['name'],
array('options' => $drop_options, 'default' => $default_option,
'multiple' => 'checkbox'));
}
unset($drop_options);
}
?>