Webservicex has stopped working, how can I make my custom Currency Rates? Maybe someone has already done, or advise the site with open api.


<?xml version="1.0" ?>
                        <name>Foreign currency</name>


class Icandy_ForeignCurrency_Model_Currency_Import_Foreign extends Mage_Directory_Model_Currency_Import_Abstract
    protected $_url = 'https://api.ratesapi.io/api/latest?base={{CURRENCY_FROM}}&symbols={{CURRENCY_TO}}';
    protected $_messages = array();

    protected $_httpClient;

    public function __construct()
        $this->_httpClient = new Varien_Http_Client();

    protected function _convert($currencyFrom, $currencyTo, $retry=0)
        $url = str_replace('{{CURRENCY_FROM}}', $currencyFrom, $this->_url);
        $url = str_replace('{{CURRENCY_TO}}', $currencyTo, $url);

        try {
            $response = $this->_httpClient
                ->setConfig(array('timeout' => Mage::getStoreConfig('currency/foreign/timeout')))
            $xml = simplexml_load_string($response, null, LIBXML_NOERROR);
            if( !$xml ) {
                $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s.', $url);
                return null;
            return (float) $xml;
        catch (Exception $e) {
            if( $retry == 0 ) {
                $this->_convert($currencyFrom, $currencyTo, 1);
            } else {
                $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s.', $url);

Why does not see my model. enter image description here

When trying to print my model gives

/var/www/i/icandy/web/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php:74: bool(false)

  • do you want automatic currency rate updater ?
    – Pawan
    Apr 10 '19 at 14:50
  • Yes. But see my updated question. Apr 10 '19 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.