57 lines
1.3 KiB
PHP
Executable file
57 lines
1.3 KiB
PHP
Executable file
<?
|
|
$i = 0;
|
|
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);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//print_r($categories);
|
|
|
|
print_r($options);
|
|
?>
|