You are here

function uc_store_default_country in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_store/uc_store.module \uc_store_default_country()
  2. 6.2 uc_store/uc_store.module \uc_store_default_country()
  3. 7.3 uc_store/uc_store.module \uc_store_default_country()
7 calls to uc_store_default_country()
uc_address_format in uc_store/uc_store.module
Format an address for display based on a country's address format.
uc_cart_pane_quotes in shipping/uc_quote/uc_quote.module
Cart pane callback.
uc_country_select in uc_store/uc_store.module
Create a country select box for a form. $display can be 'name', 'code2' for the 2-digit code, or 'code3' for the 3-digit code.
uc_store_address in uc_store/uc_store.module
uc_store_js_util in uc_store/uc_store.module
A handler for Javascript helper functions...

... See full list

File

uc_store/uc_store.module, line 2864
Contains global Ubercart functions and store administration functionality.

Code

function uc_store_default_country() {
  static $default;
  if (!empty($default)) {
    return $default;
  }
  $default = variable_get('uc_store_country', 840);
  $result = db_result(db_query("SELECT COUNT(*) FROM {uc_countries} WHERE country_id = %d AND version > 0", $default));
  if ($result == 0) {
    $default = db_result(db_query("SELECT country_id FROM {uc_countries} WHERE version > 0 ORDER BY country_name LIMIT 1"));
  }
  return $default;
}