Quote from maleabil on August 1, 2019, 11:56
Hi!
I need to have as a selector:
https://www.bnr.ro/nbrfxrates.xml
It worked for me in the previous versions by altering the ECB selector (code bellow). Now is not working anymore. Can you inlude it in your plugin into the future updates? My license has expired but i am prepared to buy a new one if you will include bnr selector, otherwise i can't use the plugin. Thank you!
case 'ecb':
$url = 'http://www.bnro.ro/nbrfxrates.xml';
if (function_exists('curl_init') AND $woocs_use_curl) {
$res = $this->file_get_contents_curl($url);
} else {
$res = file_get_contents($url);
}
$currency_data = simplexml_load_string($res);
$rates = array();
if (empty($currency_data->Body->Cube)) {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
break;
}
foreach ($currency_data->Body->Cube->Rate as $xml) {
$att = (array) $xml->attributes();
$final['rate'] = (string) $xml;
$rates[$att['@attributes']['currency']] = floatval($final['rate']);
}
//***
if (!empty($rates)) {
if ($this->default_currency != 'RON') {
if ($_REQUEST['currency_name'] != 'RON') {
if (isset($_REQUEST['currency_name'])) {
$request = floatval($rates[$this->escape($_REQUEST['currency_name'])] / $rates[$this->default_currency]);
} else {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
} else {
$request = ($rates[$this->default_currency]);
$request = $request + $request * 1/100;
}
} else {
if ($_REQUEST['currency_name'] != 'RON') {
if ($rates[$_REQUEST['currency_name']] < 1) {
$request = 1 / $rates[$_REQUEST['currency_name']];
} else {
$request = $rates[$_REQUEST['currency_name']];
}
} else {
$request = 1;
}
}
} else {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
//***
if (!$request) {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
break;
Hi!
I need to have as a selector:
https://www.bnr.ro/nbrfxrates.xml
It worked for me in the previous versions by altering the ECB selector (code bellow). Now is not working anymore. Can you inlude it in your plugin into the future updates? My license has expired but i am prepared to buy a new one if you will include bnr selector, otherwise i can't use the plugin. Thank you!
case 'ecb':
$url = 'http://www.bnro.ro/nbrfxrates.xml';
if (function_exists('curl_init') AND $woocs_use_curl) {
$res = $this->file_get_contents_curl($url);
} else {
$res = file_get_contents($url);
}
$currency_data = simplexml_load_string($res);
$rates = array();
if (empty($currency_data->Body->Cube)) {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
break;
}
foreach ($currency_data->Body->Cube->Rate as $xml) {
$att = (array) $xml->attributes();
$final['rate'] = (string) $xml;
$rates[$att['@attributes']['currency']] = floatval($final['rate']);
}
//***
if (!empty($rates)) {
if ($this->default_currency != 'RON') {
if ($_REQUEST['currency_name'] != 'RON') {
if (isset($_REQUEST['currency_name'])) {
$request = floatval($rates[$this->escape($_REQUEST['currency_name'])] / $rates[$this->default_currency]);
} else {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
} else {
$request = ($rates[$this->default_currency]);
$request = $request + $request * 1/100;
}
} else {
if ($_REQUEST['currency_name'] != 'RON') {
if ($rates[$_REQUEST['currency_name']] < 1) {
$request = 1 / $rates[$_REQUEST['currency_name']];
} else {
$request = $rates[$_REQUEST['currency_name']];
}
} else {
$request = 1;
}
}
} else {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
//***
if (!$request) {
$request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name']));
}
break;