function basic_cart_admin_content_type in Basic cart 7.3
Same name and namespace in other branches
- 7 basic_cart.admin.inc \basic_cart_admin_content_type()
- 7.2 basic_cart.admin.inc \basic_cart_admin_content_type()
Callback for the admin configuration page.
1 string reference to 'basic_cart_admin_content_type'
- basic_cart_menu in ./
basic_cart.module - Implements hook_menu().
File
- ./
basic_cart.admin.inc, line 11 - Basic cart admin settings forms.
Code
function basic_cart_admin_content_type() {
module_load_include('inc', 'basic_cart', 'basic_cart.cart');
$node_types = node_type_get_types();
if (empty($node_types)) {
return NULL;
}
$options = array();
foreach ($node_types as $node_type => $type) {
if ($node_type == 'order' && module_exists('basic_cart_order')) {
continue;
}
$options[$node_type] = check_plain($type->name);
}
$default_value = array();
foreach (basic_cart_product_types() as $product_type) {
if (isset($options[$product_type])) {
$default_value[$product_type] = $product_type;
}
}
$form['content_type'] = array(
'#title' => t('Content type selection'),
'#type' => 'fieldset',
'#description' => t('Please select the content types for which you wish to have the "Add to cart" option.'),
);
$form['content_type']['basic_cart_content_types'] = array(
'#title' => t('Content types'),
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => $default_value,
);
$form['currency'] = array(
'#title' => t('Currency and price'),
'#type' => 'fieldset',
'#description' => t('Please select the currency in which the prices will be calculated.'),
);
$form['currency']['basic_cart_currency'] = array(
'#title' => t('Currency'),
'#type' => 'select',
'#options' => currency_options(),
'#description' => t("Please choose the currency."),
'#default_value' => variable_get('basic_cart_currency'),
);
$form['currency']['basic_cart_price_format'] = array(
'#title' => t('Price format'),
'#type' => 'select',
'#options' => _basic_cart_price_format(),
'#description' => t("Please choose the format in which the price will be shown."),
'#default_value' => variable_get('basic_cart_price_format'),
);
$form['vat'] = array(
'#title' => t('VAT'),
'#type' => 'fieldset',
);
$form['vat']['basic_cart_vat_state'] = array(
'#title' => t('Check if you want to apply the VAT tax on the total amount in the checkout process.'),
'#type' => 'checkbox',
'#default_value' => variable_get('basic_cart_vat_state', FALSE),
);
$form['vat']['basic_cart_vat_value'] = array(
'#title' => t('VAT value'),
'#type' => 'textfield',
'#description' => t("Please enter VAT value."),
'#field_suffix' => '%',
'#size' => 10,
'#default_value' => variable_get('basic_cart_vat_value', ''),
);
$form['redirect'] = array(
'#title' => t('Redirect user after adding an item to the shopping cart'),
'#type' => 'fieldset',
);
$form['redirect']['basic_cart_redirect_user_after_add_to_cart'] = array(
'#title' => t('Add to cart redirect'),
'#type' => 'textfield',
'#description' => t("Enter the page you wish to redirect the customer to when an item is added to the cart, or <none> for no redirect."),
'#default_value' => variable_get('basic_cart_redirect_user_after_add_to_cart'),
'#field_prefix' => url(NULL, array(
'absolute' => TRUE,
)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}