function uc_coupon_settings_form in Ubercart Discount Coupons 7.2
Same name and namespace in other branches
- 6 uc_coupon.admin.inc \uc_coupon_settings_form()
- 7.3 uc_coupon.admin.inc \uc_coupon_settings_form()
Store-wide coupon settings form.
1 string reference to 'uc_coupon_settings_form'
- uc_coupon_menu in ./
uc_coupon.module - Implements hook_menu().
File
- ./
uc_coupon.admin.inc, line 10 - Discount Coupons administration pages.
Code
function uc_coupon_settings_form($form, &$form_state) {
global $base_url;
$form['uc_coupon_line_item_format'] = array(
'#type' => 'textfield',
'#title' => t('Default line item title format'),
'#description' => t('Controls the way coupons appear in the cart and order summary. This setting be overridden by individual coupons.'),
'#default_value' => variable_get('uc_coupon_line_item_format', t('Coupon !code', array(
'!code' => '[uc_coupon:code]',
))),
);
if (module_exists('token')) {
$form['uc_coupon_line_item_format']['#description'] .= ' ' . t('You may use any of the following replacement patterns.');
$form['uc_coupon_line_item_format']['#suffix'] = theme('token_tree', array(
'token_types' => array(
'uc_coupon',
),
));
}
$form['uc_coupon_show_in_cart'] = array(
'#type' => 'checkbox',
'#title' => t('Show coupons as an item in the cart.'),
'#default_value' => variable_get('uc_coupon_show_in_cart', TRUE),
);
$options = array();
for ($i = -10; $i <= 10; $i++) {
$options[$i] = $i;
}
$form['uc_li_coupon_weight'] = array(
'#type' => 'select',
'#title' => t('Line item weight'),
'#description' => t('Controls the placement of the coupon line item in the order summary. Heavier items appear lower in the list.'),
'#options' => $options,
'#default_value' => variable_get('uc_li_coupon_weight', 0),
);
$form['uc_coupon_form_components'] = array(
'#title' => t('Coupon submission form components'),
'#description' => t('Select what to display on the coupon submission form (this appears in the coupon block, cart and checkout panes).
Note that you must enable the coupon code entry field in order for customers to submit coupons. Also, if coupons are not displayed
in the cart (see above), you must enable either the active coupons table or the active coupons list in order for custmers to be able
to remove coupons.'),
'#type' => 'checkboxes',
'#options' => array(
'entry' => t('Coupon code entry field'),
'table' => t('Active coupons (table)'),
'list' => t('Active coupons (list)'),
),
'#default_value' => variable_get('uc_coupon_form_components', drupal_map_assoc(variable_get('uc_coupon_allow_multiple', FALSE) ? array(
'entry',
) : array(
'entry',
'list',
))),
);
$form['uc_coupon_allow_multiple'] = array(
'#type' => 'checkbox',
'#title' => t('Allow multiple coupons to apply to a single order.'),
'#default_value' => variable_get('uc_coupon_allow_multiple', FALSE),
'#description' => t('Note, you must enable this feature if you have configured multiple automatic coupons,
even if the restrictions for those coupons would prevent them ever applying to the same order.'),
);
$form['uc_coupon_default_usage'] = array(
'#type' => 'radios',
'#title' => t('Default redemption setting for new coupons'),
'#options' => array(
'single' => t('Single use per code.'),
'multi' => t('Multiple uses per code.'),
),
'#default_value' => variable_get('uc_coupon_default_usage', 'single'),
);
$form['uc_coupon_used_order_status'] = array(
'#type' => 'select',
'#title' => t('Order status to mark a coupon used'),
'#options' => uc_order_status_options_list(),
'#default_value' => variable_get('uc_coupon_used_order_status', 'processing'),
'#description' => t('A coupon will be considered used when it has been applied to an order that reaches this status
(or a later one). If the order status subsequenty reverts to an earlier status, the coupon use will also be reverted.'),
);
$form['uc_coupon_querystring'] = array(
'#type' => 'textfield',
'#title' => t('Query string parameter'),
'#description' => t('If set, coupon codes can be applied by including them in any URL. Leave blank to disable this feature.<br />Example: if set to "coupon", visiting !base_url?coupon=CODE will apply the CODE coupon.', array(
'!base_url' => $base_url,
)),
'#default_value' => variable_get('uc_coupon_querystring', ''),
'#size' => 15,
);
$form['uc_coupon_expiry'] = array(
'#title' => t('Coupon activation/expiration time'),
'#type' => 'item',
'#description' => t('Date-restricted coupons will activate and expire at this hour on the dates specified for the
individual coupon. Note that changing this setting will not effect coupons which have already been created. To
update the activation/expiration times of existing coupons, edit and save them.'),
);
$form['uc_coupon_expiry']['uc_coupon_expiry_hour'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(range(0, 23, 1), '_uc_coupon_format_hour'),
'#default_value' => variable_get('uc_coupon_expiry_hour', 0),
);
$form['uc_coupon_expiry']['uc_coupon_expiry_timezone'] = array(
'#type' => 'radios',
'#options' => array(
0 => 'UTC',
1 => 'Local',
),
'#default_value' => variable_get('uc_coupon_expiry_timezone', 0),
);
return system_settings_form($form);
}