You are here

function basic_cart_install in Basic cart 7.2

Same name and namespace in other branches
  1. 7.3 basic_cart.install \basic_cart_install()
  2. 7 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 %CUSTOMER_NAME (%CUSTOMER_EMAIL)
Here are the order details:
%ORDER_DETAILS');
  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:
%ORDER_DETAILS
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>');

  // Check to see if the price field already exists.
  $field = field_info_field('price');

  // If the price field does not exist then create it.
  if (empty($field)) {
    $field = array(
      'field_name' => 'price',
      'type' => 'number_decimal',
      '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);
}