You are here

function uc_cart_checkout_settings_overview in Ubercart 5

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

File

uc_cart/uc_cart.module, line 834

Code

function uc_cart_checkout_settings_overview() {
  $sections[] = array(
    'edit' => 'admin/store/settings/checkout/edit',
    'title' => t('Checkout settings'),
    'items' => array(
      t('Checkout is !status.', array(
        '!status' => variable_get('uc_checkout_enabled', TRUE) ? t('enabled') : t('disabled'),
      )),
      t('Anonymous checkout is !status.', array(
        '!status' => variable_get('uc_checkout_anonymous', TRUE) ? t('enabled') : t('disabled'),
      )),
      t('Review order button on checkout page says %text.', array(
        '%text' => variable_get('uc_checkout_review_button', t('Review order')),
      )),
      t('Submit order button on review page says %text.', array(
        '%text' => variable_get('uc_checkout_submit_button', t('Submit order')),
      )),
      t('Shipping fields are !option.', array(
        '!option' => variable_get('uc_cart_delivery_not_shippable', TRUE) ? t('hidden when applicable') : t('always shown'),
      )),
      t('Checkout panes are !option.', array(
        '!option' => variable_get('uc_use_next_buttons', FALSE) ? t('collapsed with next buttons') : t('expanded by default'),
      )),
      t('Collapsible panes will !text when their next buttons are clicked.', array(
        '!text' => variable_get('uc_collapse_current_pane', FALSE) ? t('collapse') : t('not collapse'),
      )),
      t('Next buttons on checkout panes say %text.', array(
        '%text' => variable_get('uc_checkout_next_button', t('Next')),
      )),
      t('New customers !option.', array(
        '!option' => variable_get('uc_new_customer_email', TRUE) ? t('receive an e-mail with their account details') : t('will only see their details in their initial order e-mail.'),
      )),
      t('New customer account status will be !status.', array(
        '!status' => variable_get('uc_new_customer_status_active', TRUE) ? t('active') : t('blocked'),
      )),
      t('Checkout completion page !text.', array(
        '!text' => variable_get('uc_cart_checkout_complete_page', '') == '' ? t('will be the default page.') : t('has been set to !url', array(
          '!url' => variable_get('uc_cart_checkout_complete_page', ''),
        )),
      )),
    ),
  );
  $panes = _checkout_pane_list();
  $items = array();
  foreach ($panes as $pane) {
    $items[] = t('!title is !enabled.', array(
      '!title' => $pane['title'],
      '!enabled' => $pane['enabled'] ? t('enabled') : t('disabled'),
    ));
  }
  $sections[] = array(
    'edit' => 'admin/store/settings/checkout/edit/panes',
    'title' => t('Checkout panes (in display order)'),
    'items' => $items,
  );
  $items = array();
  $messages = array(
    'checkout_instructions' => array(
      'title' => t('Checkout instructions are'),
      'variable' => 'uc_checkout_instructions',
    ),
    'review_instructions' => array(
      'title' => t('Review instructions are'),
      'variable' => 'uc_checkout_review_instructions',
    ),
    'completion_message' => array(
      'title' => t('Completion message is'),
      'variable' => 'uc_msg_order_submit',
    ),
    'completion_logged_in' => array(
      'title' => t('Completion text for logged in users is'),
      'variable' => 'uc_msg_order_logged_in',
    ),
    'completion_existing_user' => array(
      'title' => t('Completion text for not logged in users is'),
      'variable' => 'uc_msg_order_existing_user',
    ),
    'completion_new_user' => array(
      'title' => t('Completion text for totally new users is'),
      'variable' => 'uc_msg_order_new_user',
    ),
    'continue_shopping' => array(
      'title' => t('Continue shopping text is'),
      'variable' => 'uc_msg_continue_shopping',
    ),
  );
  foreach ($messages as $message_id => $data) {
    $current = variable_get($data['variable'], uc_get_message($message_id));
    if (empty($current)) {
      $items[] = t('!title not set.', array(
        '!title' => $data['title'],
      ));
    }
    else {
      $items[] = t('!title set.', array(
        '!title' => $data['title'],
      ));
    }
  }
  $sections[] = array(
    'edit' => 'admin/store/settings/checkout/edit/messages',
    'title' => t('Checkout messages'),
    'items' => $items,
  );
  $items = array();
  $fields = array(
    'first_name' => uc_get_field_name('first_name'),
    'last_name' => uc_get_field_name('last_name'),
    'phone' => uc_get_field_name('phone'),
    'company' => uc_get_field_name('company'),
    'street1' => uc_get_field_name('street1'),
    'street2' => uc_get_field_name('street2'),
    'city' => uc_get_field_name('city'),
    'zone' => uc_get_field_name('zone'),
    'country' => uc_get_field_name('country'),
    'postal_code' => uc_get_field_name('postal_code'),
  );
  $current = variable_get('uc_address_fields', drupal_map_assoc(array(
    'first_name',
    'last_name',
    'phone',
    'company',
    'street1',
    'street2',
    'city',
    'zone',
    'postal_code',
    'country',
  )));
  foreach ($fields as $field => $title) {
    $items[] = t('!field is !status.', array(
      '!field' => $title,
      '!status' => isset($current[$field]) ? t('enabled') : t('disabled'),
    ));
  }
  $sections[] = array(
    'edit' => 'admin/store/settings/checkout/edit/fields',
    'title' => t('Address fields'),
    'items' => $items,
  );
  $output = theme('uc_settings_overview', $sections);
  return $output;
}