function uc_order_condition_has_products_form in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.ca.inc \uc_order_condition_has_products_form()
File
- uc_order/
uc_order_workflow.inc, line 381 - This file contains the Workflow-ng hooks and functions necessary to make the order related entity, conditions, events, and actions work.
Code
function uc_order_condition_has_products_form($settings = array(
'required' => 0,
'forbidden' => 0,
)) {
$form['required'] = array(
'#type' => 'radios',
'#title' => t('Require selected products'),
'#options' => array(
0 => t('Order has any of these products.'),
1 => t('Order has all of these products.'),
),
'#default_value' => $settings['required'],
);
$form['forbidden'] = array(
'#type' => 'radios',
'#title' => t('Forbid other products'),
'#options' => array(
0 => t('Order may have other products.'),
1 => t('Order has only these products.'),
),
'#default_value' => $settings['forbidden'],
);
$options = array();
$result = db_query("SELECT nid, model FROM {uc_products}");
while ($product = db_fetch_object($result)) {
$options[$product->nid] = $product->model;
}
$form['products'] = array(
'#type' => 'select',
'#title' => t('Products'),
'#options' => $options,
'#default_value' => $settings['products'],
'#multiple' => true,
);
return $form;
}