I am using Magento 1.9.1.0.
I want to import all my currency rates programmatically and i want to add x% extra to all available currencies.
// Code for Import Currency Rates
$currencyModel = Mage::getModel('directory/currency');
$currencies = $currencyModel->getConfigAllowCurrencies();
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$defaultCurrencies = $currencyModel->getConfigBaseCurrencies();
$rates=$currencyModel->getCurrencyRates($defaultCurrencies, $currencies);
$percentage = 1.05; // x% percentage (Example 5%)
foreach($rates[$baseCurrencyCode] as $CurrencyCode => $value ) {
$newValue = $value*$percentage;
$newValue = round($newValue,4);
$currencies = array($baseCurrencyCode => array($CurrencyCode => $newValue) );
Mage::getModel('directory/currency')->saveRates($currencies); // Update value in DB
}
How to Import Currency Rates from Webservicex ?
If i can place this code before the above line of code thats it my goal.
Any ideas ?