uc_google_checkout_init

  1. drupal
    1. 6 uc_google_checkout.module function
    2. 7 uc_google_checkout.module function
Drupal 7 uc_google_checkout_init()

Implements hook_init().

File

sites/all/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.module, line 102
Use Google Checkout to collect payment and process orders.

Code

function uc_google_checkout_init() {
  // When an order comes in from Google Checkout, we need to unset some
  // $_SESSION data. Since this isn't done under the customer's user, we
  // do it when they next load a page.
  global $user;
  $users = variable_get('uc_google_checkout_order_users', array());
  if (isset($users[$user->uid])) {
    unset($users[$user->uid]);
    if (isset($_SESSION['cart_order'])) {
      unset($_SESSION['uc_checkout'][$_SESSION['cart_order']]['do_complete']);
      unset($_SESSION['cart_order']);
    }
    variable_set('uc_google_checkout_order_users', $users);
  }

  global $conf;
  $conf['i18n_variables'][] = 'uc_google_checkout_order_cancel_reason';

  $id = variable_get('googleanalytics_account', '');
  if (module_exists('googleanalytics') && !empty($id) && _googleanalytics_visibility_pages() && _googleanalytics_visibility_user($user)) {
    $scope = variable_get('googleanalytics_js_scope', 'footer');
    drupal_add_js('document.write(unescape("%3Cscript src=\"//checkout.google.com/files/digital/ga_post.js\" type=\"text/javascript\"%3E%3C/script%3E"));', 'inline', $scope);
  }
}