/ Published in: PHP
replace /app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * Currency rate import model (From www.webservicex.net) * * @category Mage * @package Mage_Directory * @author Magento Core Team <[email protected]> */ class Mage_Directory_Model_Currency_Import_Webservicex extends Mage_Directory_Model_Currency_Import_Abstract { // protected $_url = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency={{CURRENCY_FROM}}&ToCurrency={{CURRENCY_TO}}'; protected $_url = 'http://www.google.com/ig/calculator?hl=en&q=1{{CURRENCY_TO}}=?{{CURRENCY_FROM}}'; /** * HTTP client * @var Varien_Http_Client */ protected $_httpClient; public function __construct() { $this->_httpClient = new Varien_Http_Client(); } protected function _convert($currencyFrom, $currencyTo, $retry=0) { try { $response = $this->_httpClient ->setUri($url) ->request('GET') ->getBody(); return $return; } catch (Exception $e) { if( $retry == 0 ) { $this->_convert($currencyFrom, $currencyTo, 1); } else { $this->_messages[] = Mage::helper('directory')->__('Cannot retrieve rate from %s.', $url); } } } }