function basic_cart_install in Basic cart 7.3
Same name and namespace in other branches
- 7 basic_cart.install \basic_cart_install()
- 7.2 basic_cart.install \basic_cart_install()
Implements hook_install().
File
- ./
basic_cart.install, line 26 - Basic cart install file
Code
function basic_cart_install() {
$t = get_t();
// Setting up the default currency.
variable_set('basic_cart_currency', BASIC_CART_DEFAULT_CURRENCY);
// Setting up the default messages.
variable_set('basic_cart_admin_subject', $t('New order placed'));
$default_admin_message = $t('Hi,
An order was placed by [node:title] ([node:field_email]
Ordered products:
[basic_cart_order:products]
Total price: [node:field_total_price]');
variable_set('basic_cart_admin_message', $default_admin_message);
variable_set('basic_cart_send_user_message', 1);
variable_set('basic_cart_user_subject', $t('New order placed'));
$default_user_message = $t('Hi,
You just placed an order on the website @sitename. Here are the order details:
[basic_cart_order:products]
Total price: [node:field_total_price]
We will contact you as soon as possible.', array(
'@sitename' => variable_get('site_name'),
));
variable_set('basic_cart_user_message', $default_user_message);
$default_thank_you_title = $t("Thank you.");
variable_set('basic_cart_thank_you_title', $default_thank_you_title);
$default_thank_you_message = $t("Thank you for placing an order on our website.\nWe will contact you as soon as possible.");
variable_set('basic_cart_thank_you_message', $default_thank_you_message);
// Redirect url after add to cart.
variable_set('basic_cart_redirect_user_after_add_to_cart', '<none>');
foreach (basic_cart_get_fields() as $field_name => $field_) {
// Check to see if the field field already exists.
$field = field_info_field($field_name);
// If the field does not exist then create it.
if (empty($field)) {
$field = array(
'field_name' => $field_name,
'type' => $field_['type'],
'entity_types' => array(
'node',
),
);
field_create_field($field);
}
}
// Setting the VAT default state and value.
variable_set('basic_cart_vat_state', BASIC_CART_VAT_STATE);
variable_set('basic_cart_vat_value', BASIC_CART_VAT_VALUE);
}