' . t('Click here to go to the shopping cart block configuration page.', array('!url' => url('admin/build/block/configure/uc_cart/0'))); return $output; } /** * Display an overview of the checkout settings. */ function uc_cart_checkout_settings_overview() { // Theme all the pages beneath this path into summary overviews. return theme('summary_overview', summarize_child_form_pages('admin/store/settings/checkout/edit')); } /** * General checkout settings. * * @ingroup forms */ function uc_cart_checkout_settings_form() { $form['general'] = array( '#type' => 'fieldset', '#title' => t('General checkout settings'), '#summary callback' => 'summarize_form', ); $form['general']['uc_checkout_enabled'] = array( '#type' => 'checkbox', '#title' => t('Enable checkout (disable to only use third party checkout service like PayPal Express Checkout).'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('Ubercart checkout is enabled.'), t('Ubercart checkout is disabled.'), ), '#default_value' => variable_get('uc_checkout_enabled', TRUE), ); $form['general']['uc_checkout_anonymous'] = array( '#type' => 'checkbox', '#title' => t('Enable anonymous checkout (users can checkout without logging in).'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('Anonymous checkout is enabled.'), t('Anonymous checkout is disabled.'), ), '#default_value' => variable_get('uc_checkout_anonymous', TRUE), ); $form['general']['uc_cart_delivery_not_shippable'] = array( '#type' => 'checkbox', '#title' => t('Hide shipping information when possible for carts with no shippable items.'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('Shipping fields are hidden when applicable.'), t('Shipping fields are always shown.'), ), '#default_value' => variable_get('uc_cart_delivery_not_shippable', TRUE), ); $form['pane_settings'] = array( '#type' => 'fieldset', '#title' => t('Checkout pane display options'), '#summary callback' => 'summarize_form', ); $form['pane_settings']['uc_use_next_buttons'] = array( '#type' => 'checkbox', '#title' => t('Use collapsing checkout panes with next buttons during checkout.'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('Checkout panes are collapsed with next buttons.'), t('Checkout panes are expanded by default.'), ), '#default_value' => variable_get('uc_use_next_buttons', FALSE), ); $form['pane_settings']['uc_collapse_current_pane'] = array( '#type' => 'checkbox', '#title' => t('Collapse a pane when its next button is clicked.'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('Collapsible panes will collapse when their next buttons are clicked.'), t('Collapsible panes will not collapse when their next buttons are clicked.'), ), '#default_value' => variable_get('uc_collapse_current_pane', TRUE), ); $form['completion'] = array( '#type' => 'fieldset', '#title' => t('Checkout completion settings'), '#summary callback' => 'summarize_form', ); $form['completion']['uc_new_customer_email'] = array( '#type' => 'checkbox', '#title' => t('Send new customers a separate e-mail with their account details.'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('New customers receive an e-mail with their account details.'), t('New customers will only see their details in their initial order e-mail.') ), '#default_value' => variable_get('uc_new_customer_email', TRUE), ); $form['completion']['uc_new_customer_login'] = array( '#type' => 'checkbox', '#title' => t('Login users when new customer accounts are created at checkout.'), '#summary callback' => 'summarize_null', '#default_value' => variable_get('uc_new_customer_login', FALSE), ); $form['completion']['uc_new_customer_status_active'] = array( '#type' => 'checkbox', '#title' => t('New customer accounts will be set to active.'), '#description' => t('Uncheck to create new accounts but make them blocked.'), '#summary callback' => 'summarize_checkbox', '#summary arguments' => array( t('New customer account status will be active.'), t('New customer account status will be blocked.'), ), '#default_value' => variable_get('uc_new_customer_status_active', TRUE), ); $form['completion']['uc_cart_checkout_complete_page'] = array( '#type' => 'textfield', '#title' => t('Alternate checkout completion page'), '#description' => t('Leave blank to use the default completion page (recommended).'), '#summary' => variable_get('uc_cart_checkout_complete_page', '') ? t('Checkout completion page has been set to !url.', array('!url' => variable_get('uc_cart_checkout_complete_page', ''))) : t('Checkout completion page will be the default page.'), '#default_value' => variable_get('uc_cart_checkout_complete_page', ''), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), '#size' => 16, ); return system_settings_form($form); } /** * Summarize cart and checkout panes. * * @param $form * The form passed from the summarizer * @param $panes * Any array of cart/checkout panes * @return * An array of summary information * * Although this function is called 'cart_panes', it also operates on * checkout panes, which are structured the same way. */ function _uc_cart_panes_summarize($form, $panes) { $items = array(); foreach ($panes as $pane) { $items[] = t('@title is @enabled.', array('@title' => $pane['title'], '@enabled' => $pane['enabled'] ? t('enabled') : t('disabled'))); } return $items; } /** * Settings for panes on the checkout page. * * @ingroup forms */ function uc_cart_checkout_panes_form() { $panes = _checkout_pane_list(); $form['panes'] = array( '#theme' => 'uc_pane_sort_table', '#pane_prefix' => 'uc_pane', '#summary callback' => '_uc_cart_panes_summarize', '#summary arguments' => array($panes), ); foreach ($panes as $pane) { $form['panes'][$pane['id']]['uc_pane_'. $pane['id'] .'_enabled'] = array( '#type' => 'checkbox', '#default_value' => $pane['enabled'], ); $form['panes'][$pane['id']]['title'] = array( '#value' => $pane['title'], ); $form['panes'][$pane['id']]['uc_pane_'. $pane['id'] .'_weight'] = array( '#type' => 'weight', '#default_value' => $pane['weight'], ); $null = NULL; $pane_settings = $pane['callback']('settings', $null, NULL); if (is_array($pane_settings)) { $form['pane_'. $pane['id']] = array( '#type' => 'fieldset', '#summary callback' => 'summarize_null', '#title' => t('!pane settings', array('!pane' => $pane['title'])), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['pane_'. $pane['id']] = array_merge($form['pane_'. $pane['id']], $pane_settings); } } return system_settings_form($form); } /** * Settings for help messages displayed on the checkout page. * * @ingroup forms */ function uc_cart_checkout_messages_form() { $form['uc_checkout_instructions'] = array( '#type' => 'textarea', '#title' => t('Checkout instructions'), '#description' => t('Provide instructions for customers at the top of the checkout screen.'), '#summary' => variable_get('uc_checkout_instructions', '') ? t('Checkout instructions are set.') : t('Checkout instructions are not set.'), '#default_value' => variable_get('uc_checkout_instructions', ''), '#rows' => 3, ); $form['uc_checkout_instructions_format'] = filter_form(variable_get('uc_checkout_instructions_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_checkout_instructions_format')); $form['uc_checkout_review_instructions'] = array( '#type' => 'textarea', '#title' => t('Checkout review instructions'), '#description' => t('Provide instructions for customers at the top of the checkout review screen.'), '#summary' => variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')) ? t('Review instructions are set.') : t('Review instructions are not set.'), '#default_value' => variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')), '#rows' => 3, ); $form['uc_checkout_review_instructions_format'] = filter_form(variable_get('uc_checkout_review_instructions_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_checkout_review_instructions_format')); $form['uc_msg_order_submit'] = array( '#type' => 'textarea', '#title' => t('Checkout completion message header'), '#description' => t('Header for message displayed after a user checks out. Uses order and global tokens.', array('!url' => url('admin/store/help/tokens'))), '#summary' => variable_get('uc_msg_order_submit', uc_get_message('completion_message')) ? t('Completion message is set.') : t('Completion message is not set.'), '#default_value' => variable_get('uc_msg_order_submit', uc_get_message('completion_message')), '#rows' => 3, ); $form['uc_msg_order_submit_format'] = filter_form(variable_get('uc_msg_order_submit_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_msg_order_submit_format')); $form['checkout_messages'] = array( '#type' => 'fieldset', '#title' => t('Checkout completion message body'), '#description' => t("In the following three boxes, you may use the special tokens !new_username for the username of a newly created account and !new_password for that account's password."), '#summary callback' => 'summarize_form', '#collapsible' => FALSE, ); $form['checkout_messages']['uc_msg_order_logged_in'] = array( '#type' => 'textarea', '#title' => t('Checkout completion for logged-in users'), '#description' => t('Message displayed upon checkout for a user who has logged in. Uses order and global tokens.', array('!url' => url('admin/store/help/tokens'))), '#summary' => variable_get('uc_msg_order_logged_in', uc_get_message('completion_logged_in')) ? t('Completion text for logged in users is set.') : t('Completion text for logged in users is not set.'), '#default_value' => variable_get('uc_msg_order_logged_in', uc_get_message('completion_logged_in')), '#rows' => 3, ); $form['checkout_messages']['uc_msg_order_logged_in_format'] = filter_form(variable_get('uc_msg_order_logged_in_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_msg_order_logged_in_format')); $form['checkout_messages']['uc_msg_order_existing_user'] = array( '#type' => 'textarea', '#title' => t('Checkout completion for existing users'), '#description' => t("Message displayed upon checkout for a user who has an account but wasn't logged in. Uses order and global tokens.", array('!url' => url('admin/store/help/tokens'))), '#summary' => variable_get('uc_msg_order_existing_user', uc_get_message('completion_existing_user')) ? t('Completion text for users who aren\'t logged in is set.') : t('Completion text for users who aren\'t logged in is not set.'), '#default_value' => variable_get('uc_msg_order_existing_user', uc_get_message('completion_existing_user')), '#rows' => 3, ); $form['checkout_messages']['uc_msg_order_existing_user_format'] = filter_form(variable_get('uc_msg_order_existing_user_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_msg_order_existing_user_format')); $form['checkout_messages']['uc_msg_order_new_user'] = array( '#type' => 'textarea', '#title' => t('Checkout completion for new users'), '#description' => t('Message displayed upon checkout for a new user whose account was just created. Uses order and global tokens.', array('!url' => url('admin/store/help/tokens'))), '#summary' => variable_get('uc_msg_order_new_user', uc_get_message('completion_new_user')) ? t('Completion text for new users is set.') : t('Completion text for new users is not set.'), '#default_value' => variable_get('uc_msg_order_new_user', uc_get_message('completion_new_user')), '#rows' => 3, ); $form['checkout_messages']['uc_msg_order_new_user_format'] = filter_form(variable_get('uc_msg_order_new_user_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_msg_order_new_user_format')); $form['uc_msg_continue_shopping'] = array( '#type' => 'textarea', '#title' => t('Continue shopping message'), '#description' => t('Message displayed upon checkout to direct customers to another part of your site. Uses order and global tokens.', array('!url' => url('admin/store/help/tokens'))), '#summary' => variable_get('uc_msg_continue_shopping', uc_get_message('continue_shopping')) ? t('Continue shopping text is set.') : t('Continue shopping text is not set.'), '#default_value' => variable_get('uc_msg_continue_shopping', uc_get_message('continue_shopping')), '#rows' => 3, ); $form['uc_msg_continue_shopping_format'] = filter_form(variable_get('uc_msg_continue_shopping_format', FILTER_FORMAT_DEFAULT), NULL, array('uc_msg_continue_shopping_format')); return system_settings_form($form); }