function uc_quote_admin_settings in Ubercart 6.2
Same name and namespace in other branches
- 5 shipping/uc_quote/uc_quote.module \uc_quote_admin_settings()
- 7.3 shipping/uc_quote/uc_quote.admin.inc \uc_quote_admin_settings()
Default shipping settings.
Sets the default shipping location of the store. Allows the user to determine which quotin methods are enabled and which take precedence over the others. Also sets the default quote and shipping types of all products in the store. Individual products may be configured differently.
See also
uc_quote_admin_settings_submit()
1 string reference to 'uc_quote_admin_settings'
- uc_quote_menu in shipping/
uc_quote/ uc_quote.module - Implements hook_menu().
File
- shipping/
uc_quote/ uc_quote.admin.inc, line 33 - Shipping quotes administration menu items.
Code
function uc_quote_admin_settings() {
$address = variable_get('uc_quote_store_default_address', new stdClass());
$fields = array(
'first_name',
'last_name',
'company',
'street1',
'street2',
'city',
'zone',
'postal_code',
'country',
'phone',
);
foreach ($fields as $field) {
if (!isset($address->{$field})) {
$address->{$field} = '';
}
}
$form['uc_quote_log_errors'] = array(
'#type' => 'checkbox',
'#title' => t('Log errors during checkout to watchdog'),
'#summary callback' => 'summarize_checkbox',
'#summary arguments' => array(
t('Quote errors are submitted to watchdog.'),
t('Quote errors are not submitted to watchdog.'),
),
'#default_value' => variable_get('uc_quote_log_errors', FALSE),
);
$form['uc_quote_display_debug'] = array(
'#type' => 'checkbox',
'#title' => t('Display debug information to administrators.'),
'#summary callback' => 'summarize_checkbox',
'#summary arguments' => array(
t('Debugging information is displayed to administrators when quotes are generated.'),
t('Debugging information is not displayed to administrators when quotes are generated.'),
),
'#default_value' => variable_get('uc_quote_display_debug', FALSE),
);
$form['uc_quote_require_quote'] = array(
'#type' => 'checkbox',
'#title' => t('Prevent the customer from completing an order if a shipping quote is not selected.'),
'#summary callback' => 'summarize_checkbox',
'#summary arguments' => array(
t('Customers cannot complete checkout without selecting a shipping quote.'),
t('Customers can still checkout without selecting a shipping quote.'),
),
'#default_value' => variable_get('uc_quote_require_quote', TRUE),
);
$form['uc_quote_pane_description'] = array(
'#type' => 'fieldset',
'#title' => t('Shipping quote pane description'),
'#summary callback ' => 'summarize_form',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['uc_quote_pane_description']['uc_quote_pane_description'] = array(
'#type' => 'textarea',
'#title' => t('Message text'),
'#default_value' => variable_get('uc_quote_pane_description', t('Shipping quotes are generated automatically when you enter your address and may be updated manually with the button below.')),
);
$form['uc_quote_pane_description']['uc_quote_desc_format'] = filter_form(variable_get('uc_quote_desc_format', FILTER_FORMAT_DEFAULT), NULL, array(
'uc_quote_desc_format',
));
$form['uc_quote_err_msg'] = array(
'#type' => 'fieldset',
'#title' => t('Shipping quote error message'),
'#summary callback' => 'summarize_form',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['uc_quote_err_msg']['uc_quote_err_msg'] = array(
'#type' => 'textarea',
'#title' => t('Message text'),
'#default_value' => variable_get('uc_quote_err_msg', t("There were problems getting a shipping quote. Please verify the delivery and product information and try again.\nIf this does not resolve the issue, please call in to complete your order.")),
);
$form['uc_quote_err_msg']['uc_quote_msg_format'] = filter_form(variable_get('uc_quote_msg_format', FILTER_FORMAT_DEFAULT), NULL, array(
'uc_quote_msg_format',
));
$form['uc_quote_store_default_address'] = array(
'#type' => 'fieldset',
'#title' => t('Default pickup address'),
'#description' => t("When delivering products to customers, the original location of the product must be known in order to accurately quote the shipping cost and set up a delivery. This form provides the default location for all products in the store. If a product's individual pickup address is blank, Ubercart uses the store's default pickup address specified here."),
'#summary' => t('Default pickup address is: <br />!address', array(
'!address' => uc_address_format($address->first_name, $address->last_name, $address->company, $address->street1, $address->street2, $address->city, $address->zone, $address->postal_code, $address->country),
)),
'#tree' => TRUE,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['uc_quote_store_default_address']['first_name'] = uc_textfield(uc_get_field_name('first_name'), $address->first_name, FALSE);
$form['uc_quote_store_default_address']['last_name'] = uc_textfield(uc_get_field_name('last_name'), $address->last_name, FALSE);
$form['uc_quote_store_default_address']['company'] = uc_textfield(uc_get_field_name('company'), $address->company, FALSE);
$form['uc_quote_store_default_address']['phone'] = uc_textfield(uc_get_field_name('phone'), $address->phone, FALSE, NULL, 32, 16);
$form['uc_quote_store_default_address']['street1'] = uc_textfield(uc_get_field_name('street1'), $address->street1, FALSE, NULL, 64);
$form['uc_quote_store_default_address']['street2'] = uc_textfield(uc_get_field_name('street2'), $address->street2, FALSE, NULL, 64);
$form['uc_quote_store_default_address']['city'] = uc_textfield(uc_get_field_name('city'), $address->city, FALSE);
if (isset($_POST['country'])) {
$country = $_POST['country'];
}
else {
$country = $address->country;
}
$form['uc_quote_store_default_address']['country'] = uc_country_select(uc_get_field_name('country'), $address->country);
$form['uc_quote_store_default_address']['zone'] = uc_zone_select(uc_get_field_name('zone'), $address->zone, NULL, $country);
$form['uc_quote_store_default_address']['postal_code'] = uc_textfield(uc_get_field_name('postal_code'), $address->postal_code, FALSE, NULL, 10, 10);
$form['#submit'][] = 'uc_quote_admin_settings_submit';
return system_settings_form($form);
}