function uc_order_condition_products_weight_form in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.ca.inc \uc_order_condition_products_weight_form()
File
- uc_order/
uc_order_workflow.inc, line 525 - 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_products_weight_form($settings = array()) {
$options = array(
'all' => t('<All products>'),
);
$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'],
'#description' => check_plain(t('Selecting "<All products>" will override any other selections and returns the total number of products in the order.')),
'#multiple' => true,
);
$form['weight_units'] = array(
'#type' => 'select',
'#title' => t('Unit of measurement'),
'#default_value' => $settings['weight_units'] ? $settings['weight_units'] : variable_get('uc_weight_unit', 'lb'),
'#options' => array(
'lb' => t('Pounds'),
'kg' => t('Kilograms'),
'oz' => t('Ounces'),
'g' => t('Grams'),
),
);
$form['product_weight_value'] = array(
'#type' => 'textfield',
'#title' => t('Product weight value'),
'#description' => t('Specify a value to compare the product weight against.'),
'#default_value' => $settings['product_weight_value'],
'#size' => 16,
);
$options = array(
'less' => t('Total is less than specified value.'),
'less_equal' => t('Total is less than or equal to specified value.'),
'equal' => t('Total is equal to specified value.'),
'greater_equal' => t('Total is greater than or equal to specified value.'),
'greater' => t('Total is greater than specified value.'),
);
$form['product_weight_comparison'] = array(
'#type' => 'radios',
'#title' => t('Product count comparison type'),
'#options' => $options,
'#default_value' => isset($settings['product_weight_comparison']) ? $settings['product_weight_comparison'] : 'greater_equal',
);
return $form;
}