function uc_cart_cart_settings_form in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_cart/uc_cart.module \uc_cart_cart_settings_form()
- 7.3 uc_cart/uc_cart.admin.inc \uc_cart_cart_settings_form()
General settings for the shopping cart.
See also
uc_cart_cart_settings_form_validate()
1 string reference to 'uc_cart_cart_settings_form'
- uc_cart_menu in uc_cart/
uc_cart.module - Implements hook_menu().
File
- uc_cart/
uc_cart.admin.inc, line 44 - Cart administration menu items.
Code
function uc_cart_cart_settings_form() {
$form['general'] = array(
'#type' => 'fieldset',
'#title' => t('General cart settings'),
'#summary callback' => 'summarize_form',
);
$form['general']['uc_cart_add_item_msg'] = array(
'#type' => 'checkbox',
'#title' => t('Display an update message when an item is added to the cart through an add to cart form.'),
'#default_value' => variable_get('uc_cart_add_item_msg', TRUE),
);
$form['general']['uc_add_item_redirect'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart redirect'),
'#description' => t('Enter the Drupal page to redirect to when a customer adds an item to their cart.<br />Enter <none> for no redirect.'),
'#summary' => t('Add to cart is redirecting to <br /><a href="!url">!url</a>', array(
'!url' => url(variable_get('uc_add_item_redirect', 'cart'), array(
'absolute' => TRUE,
)),
)),
'#default_value' => variable_get('uc_add_item_redirect', 'cart'),
'#size' => 32,
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
$context = array(
'revision' => 'formatted',
'type' => 'amount',
);
$form['general']['uc_minimum_subtotal'] = array(
'#type' => 'textfield',
'#title' => t('Minimum order subtotal'),
'#description' => t('Optionally specify a minimum allowed subtotal for a cart to proceed to checkout.'),
'#summary' => t('The minimum subtotal is @subtotal', array(
'@subtotal' => uc_price(variable_get('uc_minimum_subtotal', 0), $context),
)),
'#default_value' => variable_get('uc_minimum_subtotal', 0),
'#size' => 16,
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
);
$durations = array(
'singular' => array(
'minutes' => t('minute'),
'hours' => t('hour'),
'days' => t('day'),
'weeks' => t('week'),
'years' => t('year'),
),
'plural' => array(
'minutes' => t('minutes'),
'hours' => t('hours'),
'days' => t('days'),
'weeks' => t('weeks'),
'years' => t('years'),
),
);
$form['anonymous'] = array(
'#type' => 'fieldset',
'#title' => t('Anonymous cart duration'),
'#description' => t('Set the length of time products remain in the cart for customers who <strong>have not</strong> logged in. Cron must be running for this feature to work.'),
'#summary' => format_plural(variable_get('uc_cart_anon_duration', '4'), 'Anonymous cart duration is 1 @unit.', 'Anonymous cart duration is @count @units.', array(
'@unit' => $durations['singular'][variable_get('uc_cart_anon_unit', 'hours')],
'@units' => $durations['plural'][variable_get('uc_cart_anon_unit', 'hours')],
)),
);
$form['anonymous']['uc_cart_anon_duration'] = array(
'#type' => 'select',
'#title' => t('Duration'),
'#options' => drupal_map_assoc(uc_range(1, 60)),
'#default_value' => variable_get('uc_cart_anon_duration', '4'),
'#prefix' => '<div style="float: left; margin-right: 1em;">',
'#suffix' => '</div>',
);
$form['anonymous']['uc_cart_anon_unit'] = array(
'#type' => 'select',
'#title' => t('Unit of time'),
'#options' => array(
'minutes' => t('Minute(s)'),
'hours' => t('Hour(s)'),
'days' => t('Day(s)'),
'weeks' => t('Week(s)'),
'years' => t('Year(s)'),
),
'#default_value' => variable_get('uc_cart_anon_unit', 'hours'),
'#prefix' => '<div style="float: left; margin-right: 1em;">',
'#suffix' => '</div>',
);
$form['authenticated'] = array(
'#type' => 'fieldset',
'#title' => t('Authenticated cart duration'),
'#description' => t('Set the length of time products remain in the cart for customers who <strong>have</strong> logged in. Cron must be running for this feature to work.'),
'#summary' => format_plural(variable_get('uc_cart_auth_duration', '1'), 'Authenticated cart duration is 1 @unit.', 'Authenticated cart duration is @count @units.', array(
'@unit' => $durations['singular'][variable_get('uc_cart_auth_unit', 'years')],
'@units' => $durations['plural'][variable_get('uc_cart_auth_unit', 'years')],
)),
);
$form['authenticated']['uc_cart_auth_duration'] = array(
'#type' => 'select',
'#title' => t('Duration'),
'#options' => drupal_map_assoc(uc_range(1, 24)),
'#default_value' => variable_get('uc_cart_auth_duration', '1'),
'#prefix' => '<div style="float: left; margin-right: 1em;">',
'#suffix' => '</div>',
);
$form['authenticated']['uc_cart_auth_unit'] = array(
'#type' => 'select',
'#title' => t('Unit of time'),
'#options' => array(
'hours' => t('Hour(s)'),
'days' => t('Day(s)'),
'weeks' => t('Week(s)'),
'years' => t('Year(s)'),
),
'#default_value' => variable_get('uc_cart_auth_unit', 'years'),
'#prefix' => '<div style="float: left; margin-right: 1em;">',
'#suffix' => '</div>',
);
$form['continue_shopping'] = array(
'#type' => 'fieldset',
'#title' => t('Continue shopping element'),
'#description' => t('Ubercart will add a continue shopping to the cart page based on the settings below.'),
'#summary' => t('Continue shopping !type is: <br />!link', array(
'!type' => variable_get('uc_continue_shopping_type', 'link') == 'link' ? t('link') : t('button'),
'!link' => l(variable_get('uc_continue_shopping_text', '') ? variable_get('uc_continue_shopping_text', '') : t('Continue shopping'), variable_get('uc_continue_shopping_url', '')),
)),
);
$form['continue_shopping']['uc_continue_shopping_type'] = array(
'#type' => 'radios',
'#title' => t('Continue shopping element display'),
'#options' => array(
'link' => t('Text link'),
'button' => t('Button'),
'none' => t('None'),
),
'#default_value' => variable_get('uc_continue_shopping_type', 'link'),
);
$form['continue_shopping']['uc_continue_shopping_use_last_url'] = array(
'#type' => 'checkbox',
'#title' => t('Make the continue shopping link send customers back to product pages after adding items to the cart.'),
'#description' => t('If this is disabled, the URL specified below will always be used.'),
'#default_value' => variable_get('uc_continue_shopping_use_last_url', TRUE),
);
$form['continue_shopping']['uc_continue_shopping_url'] = array(
'#type' => 'textfield',
'#title' => t('Default continue shopping link URL'),
'#description' => t('Enter the Drupal page for the link to continue shopping from the cart view page.'),
'#default_value' => variable_get('uc_continue_shopping_url', ''),
'#size' => 32,
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
$form['continue_shopping']['uc_continue_shopping_text'] = array(
'#type' => 'textfield',
'#title' => t('Custom continue shopping link text'),
'#description' => t('Enter custom text for the continue shopping link.'),
'#default_value' => variable_get('uc_continue_shopping_text', ''),
);
$form['breadcrumb'] = array(
'#type' => 'fieldset',
'#title' => t('Cart breadcrumb'),
'#description' => t('Drupal automatically adds a Home breadcrumb to the cart page. You can use these settings to specify a custom breadcrumb to use on the cart page instead. If a custom text is not supplied, the default Home breadcrumb will be displayed.'),
'#summary' => variable_get('uc_cart_breadcrumb_text', '') ? t('Custom cart breadcrumb is: <br />!breadcrumb', array(
'!breadcrumb' => l(variable_get('uc_cart_breadcrumb_text', ''), variable_get('uc_cart_breadcrumb_url', '')),
)) : t('Not using a custom cart breadcrumb.'),
);
$form['breadcrumb']['uc_cart_breadcrumb_text'] = array(
'#type' => 'textfield',
'#title' => t('Custom cart breadcrumb text'),
'#description' => t('Enter the text for the custom breadcrumb on the cart page.'),
'#default_value' => variable_get('uc_cart_breadcrumb_text', ''),
);
$form['breadcrumb']['uc_cart_breadcrumb_url'] = array(
'#type' => 'textfield',
'#title' => t('Custom cart breadcrumb URL'),
'#description' => t('Enter the Drupal page linked to in the custom breadcrumb on the cart view page.'),
'#default_value' => variable_get('uc_cart_breadcrumb_url', ''),
'#size' => 32,
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
return system_settings_form($form);
}