带有google convertor URL的magento webservicex
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了带有google convertor URL的magento webservicex相关的知识,希望对你有一定的参考价值。
replace /app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php
<?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); } } } }
以上是关于带有google convertor URL的magento webservicex的主要内容,如果未能解决你的问题,请参考以下文章
Spring类型转换 ConversionSerivce Convertor
python: 带有 BeautifulSoup 的 Google 搜索刮板
SAP Hybris的Convertor, Populator, Facade和DTO这几个概念是如何协同工作的