public function getCountryList() { $country_list_arr = array(); $country_arr = CurrencyExchangeRate::whereRaw("status = ? ORDER BY country", array('Active'))->get(array('country', 'country_code')); foreach ($country_arr as $value) { $country_list_arr[$value['country_code']] = $value['country']; } return $country_list_arr; }
/** * CUtil::chkIsValidCurrency() * added by periyasami_145at11 * * @param mixed $currency_code * @return */ public static function chkIsValidCurrency($currency_code) { $details = array(); $selected_currency_code = CurrencyExchangeRate::whereRaw('currency_code= ? AND status = "Active" AND display_currency = "Yes" ', array($currency_code))->first(); if (count($selected_currency_code)) { $details['country'] = $selected_currency_code['country']; $details['currency_code'] = $selected_currency_code['currency_code']; $details['exchange_rate'] = $selected_currency_code['exchange_rate']; $details['currency_symbol'] = $selected_currency_code['currency_symbol']; } return $details; }
public static function getLocatorApiCurrencyCode() { $locatorhq_username = \Config::get("webshoppack::locatorhq_api_username"); $locatorhq_apikey = \Config::get("webshoppack::locatorhq_api_key"); $currencyCode = "USD"; if ($locatorhq_username != "" && $locatorhq_apikey != "") { $ipaddresslist = $_SERVER["REMOTE_ADDR"]; $locator_url = "http://api.locatorhq.com/?user="******"&key=" . $locatorhq_apikey . "&ip=" . $ipaddresslist . "&format=text"; //$result = explode(',',file_get_contents($locator_url)); $result = explode(',', CUtil::getContents($locator_url)); if (sizeof($result) > 1) { $country_name = $result[1]; if ($country_name != "" && $country_name != "-") { $currency_exchange = CurrencyExchangeRate::select('currency_code')->where('country', '=', $country_name)->get(); if (sizeof($currency_exchange) > 0) { return $currency_exchange[0]['currency_code']; } } } } return $currencyCode; }