You are here

function uc_cart_cart_settings_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart/uc_cart.admin.inc \uc_cart_cart_settings_form()
  2. 7.3 uc_cart/uc_cart.admin.inc \uc_cart_cart_settings_form()
1 string reference to 'uc_cart_cart_settings_form'
uc_cart_menu in uc_cart/uc_cart.module
Implementation of hook_menu().

File

uc_cart/uc_cart.module, line 667

Code

function uc_cart_cart_settings_form() {
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General cart settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $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 &lt;none&gt; for no redirect.'),
    '#default_value' => variable_get('uc_add_item_redirect', 'cart'),
    '#size' => 32,
    '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q='),
  );
  $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.'),
    '#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', '$') : '',
  );
  $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.'),
    '#collapsible' => FALSE,
  );
  $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.'),
    '#collapsible' => FALSE,
  );
  $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 link'),
    '#collapsed' => FALSE,
    '#collapsible' => FALSE,
  );
  $form['continue_shopping']['uc_continue_shopping_type'] = array(
    '#type' => 'radios',
    '#title' => t('Display the continue shopping link as'),
    '#options' => array(
      'link' => t('A text link'),
      'button' => t('A button link'),
    ),
    '#default_value' => variable_get('uc_continue_shopping_type', 'link'),
  );
  $form['continue_shopping']['uc_continue_shopping_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Continue shopping link URL'),
    '#description' => t('Enter the Drupal page for the link to continue shopping from the cart view page.<br />Enter &lt;none&gt; for no link to appear.'),
    '#default_value' => variable_get('uc_continue_shopping_url', ''),
    '#size' => 32,
    '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q='),
  );
  $form['continue_shopping']['uc_continue_shopping_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Continue shopping link text'),
    '#description' => t('Enter the text for the continue shopping link.'),
    '#default_value' => variable_get('uc_continue_shopping_text', t('Continue shopping')),
  );
  $form['breadcrumb'] = array(
    '#type' => 'fieldset',
    '#title' => t('Cart breadcrumb'),
    '#collapsed' => FALSE,
    '#collapsible' => FALSE,
  );
  $form['breadcrumb']['uc_cart_breadcrumb_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Default cart breadcrumb URL'),
    '#description' => t('Enter the Drupal page linked to in the default breadcrumb on the cart view page.'),
    '#default_value' => variable_get('uc_cart_breadcrumb_url', ''),
    '#size' => 32,
    '#field_prefix' => url(NULL, NULL, NULL, TRUE) . (variable_get('clean_url', 0) ? '' : '?q='),
  );
  $form['breadcrumb']['uc_cart_breadcrumb_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Default cart breadcrumb text'),
    '#description' => t('Enter the text for the default breadcrumb on the cart page.'),
    '#default_value' => variable_get('uc_cart_breadcrumb_text', t('Home')),
  );
  return system_settings_form($form);
}