Author Topic: Failed to retrieve the Currency Converter XML document  (Read 60339 times)

pipi710

  • Beginner
  • *
  • Posts: 4
Failed to retrieve the Currency Converter XML document
« on: August 06, 2010, 15:38:24 PM »
I use VM 1.1.4 stable version
The ordering process doesn't work correctly.

The error messages are the followings:
Error: connect() timed out!
Error: Failed to retrieve the Currency Converter XML document.

It seems it has a problem with currency converter. I don't want use currency converter, because I would like to use the price in USD. So I disabled the currency modul, and set only USD on configuration panel. But it hasn't solved the problem.
Who can help me?


Pakito-san

  • Beginner
  • *
  • Posts: 1
Re: Failed to retrieve the Currency Converter XML document
« Reply #1 on: January 17, 2011, 03:37:16 AM »
I wanted to continue with this topic because it seems that nobody replied to it and it is something that still happens with the VirtueMart 1.1.6 Stable version.

In my case I receive exactly the same messages:

I am using Zeolite II template, but also with Larix, Beez, Mesolite II and other templates occurs the same. So there shouldn't be a problem with the templates but with the VirtueMart installation because the messages are shown with the products in the shop side of the joomla page.

I would like that somebody could help us bringing some light to this issue and if possible to come up with a precise and detailed instruction on how to fix it. My knowledge in programming (as many of us) is rather low so I would appreciate that the instructions could be detailed. I use VirtueMart since a while and don't have experience but I would like to run my e-shop as smoothly as possible.

Please some help would be nicely appreciated.
Regards,

titchagui

  • Beginner
  • *
  • Posts: 14
Re: Failed to retrieve the Currency Converter XML document
« Reply #2 on: January 19, 2011, 17:39:54 PM »
Is the vendor currency the same as product currency?
To check it:
- Go to Store/Edit store and verify "Currency Display Style" content.
- Go to your(s) product(s) and verify currency used by "Product Price".
They should have the same currency.

Note: This error is independent of currency module which is only used as a Joomla module to allow a customer to change the currency displayed in store.


hanandeebes

  • Beginner
  • *
  • Posts: 4
Re: Failed to retrieve the Currency Converter XML document
« Reply #3 on: March 05, 2011, 18:17:26 PM »
Thank you for this solution it helped me too.

Hanan

icointepas

  • Beginner
  • *
  • Posts: 4
Re: Failed to retrieve the Currency Converter XML document
« Reply #4 on: April 22, 2011, 20:40:50 PM »
Otherwise another solution may help you...

You can ignore webservices calls from virtuemart and avoid some unwanted situations and errors in doing this :
1- create a file called "Nconvertion.php" in /administrator/components/com_virtuemart/classes/currency/

2- paste this code within it :

<?php

if(

!defined( '_VALID_MOS' )

&&

!defined( '_JEXEC' ) )

die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

class convertNOP {
  function convert( $amountA, $currA='', $currB='' ) {
    return $amountA;
  }
}

?>

3- Go to virtuemart administration : Configuration > Global > Core Settings > Core Settings and choose "Nconvertion.php" in the list.


This was given here "http://libre-d-esprit.thinking-days.net/2009/03/rendre-virtuemart-utilisable-en-mode-offline/"

Ivan

i-Catalyse
Ivan COINTEPAS icointepas@i-catalyse.com - supports@bouticat.com

Steo

  • Beginner
  • *
  • Posts: 11
Re: Failed to retrieve the Currency Converter XML document
« Reply #5 on: June 24, 2011, 02:58:30 AM »
Hi everybody,

I'm experiencing the same error, and mine gets deeper.
Although on the back end my currency is correctly set to EUR, both on items price and in shop config, in the front end the currency doesn't appear (item's price is only a number, without the currency symbol)

As if that was not enough, when a customer proceed to the paypal checkout, the currency shown by PayPal is $ instead of EUR.

I've tried both solutions on this page, and i get back this:


Fatal error: Call to a member function convert() on a non-object in /home2/kitedumm/public_html/administrator/components/com_virtuemart/classes/ps_product.php on line 2217


Please help me! 

darkedge3

  • Beginner
  • *
  • Posts: 2
Re: Failed to retrieve the Currency Converter XML document
« Reply #6 on: July 13, 2011, 15:09:30 PM »
Same problem here - exacty the same

Fatal error: Call to a member function convert() on a non-object in /var/www/vhosts/skirtingboards.co.uk/httpdocs/administrator/components/com_virtuemart/classes/ps_product.php on line 2217


This just started happening by itself - no idea why

Any help pls ?

stAn99

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 100
    • One Page Checkout for Virtuemart 2
Re: Failed to retrieve the Currency Converter XML document
« Reply #7 on: August 19, 2013, 15:55:22 PM »
Dear friends, if you get this error it may be caused by CURL error, insufficient write permissions for the XML file or connection timeout to the ECB server. We've updated the file here:
Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* ECB Currency Converter Module

* @version $Id: convertECB.php 1948 2009-09-30 14:32:48Z soeren_nb $
* @package VirtueMart
* @subpackage classes
* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/

/**
 * This class uses the currency rates provided by an XML file from the European Central Bank
 * Requires cURL or allow_url_fopen
 */
class convertECB {

var $archive true;
var $last_updated '';

var $document_address 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml';

var $info_address 'http://www.ecb.int/stats/eurofxref/';
var $supplier 'European Central Bank';

/**
 * Initializes the global currency converter array
 *
 * @return mixed
 */
function init() {
global $mosConfig_cachepath$mosConfig_absolute_path,
$vendor_currency$vmLogger;

if( !is_array($GLOBALS['converter_array']) && $GLOBALS['converter_array'] !== -) {
setlocale(LC_TIME"en-GB");
$now time() + 3600// Time in ECB (Germany) is GMT + 1 hour (3600 seconds)
if (date("I")) {
$now += 3600// Adjust for daylight saving time
}
$weekday_now_local gmdate('w'$now); // week day, important: week starts with sunday (= 0) !!
$date_now_local gmdate('Ymd'$now);
$time_now_local gmdate('Hi'$now);
$time_ecb_update '1415';
if( is_writable($mosConfig_cachepath) ) {
$store_path $mosConfig_cachepath;
}
else {
$store_path $mosConfig_absolute_path."/media";
}
  
$archivefile_name $store_path.'/daily.xml';
$ecb_filename $this->document_address;
$val '';


if(file_exists($archivefile_name) && filesize$archivefile_name ) > ) {
   // timestamp for the Filename
   $file_datestamp date('Ymd'filemtime($archivefile_name)); 
//stAn, in all cases always load the contents
   $contents = @file_get_contents$archivefile_name );
     // check if today is a weekday - no updates on weekends
     if( date'w' ) > && date'w' ) < 
     // compare filedate and actual date
     && $file_datestamp != $date_now_local
     // if localtime is greater then ecb-update-time go on to update and write files
     && $time_now_local $time_ecb_update) {
     $curr_filename $ecb_filename;
     }
     else {
   $curr_filename $archivefile_name;
     $this->last_updated $file_datestamp;
   $this->archive false;
     }
}
else {
$curr_filename $ecb_filename;
}
  
if( !is_writable$store_path )) {
  $this->archive false;
  $vmLogger->debug"The file $archivefile_name can't be created. The directory $store_path is not writable" );
}
if( $curr_filename == $ecb_filename 
{
// Fetch the file from the internet
require_once( CLASSPATH.'connectionTools.class.php');
$contents_ecb vmConnector::handleCommunication$ecb_filename );
if (empty($contents_ecb))
$contents_ecb = @file_get_contents$ecb_filename );
$this->last_updated date('Ymd');

}

if (!empty($contents_ecb)) $contents $contents_ecb

if( $contents ) {
// if archivefile does not exist
if( $this->archive ) {
// now write new file
file_put_contents$archivefile_name$contents );
}

$contents str_replace ("<Cube currency='USD'"" <Cube currency='EUR' rate='1'/> <Cube currency='USD'"$contents);

/* XML Parsing */
require_once( $mosConfig_absolute_path'/includes/domit/xml_domit_lite_include.php' );
$xmlDoc = new DOMIT_Lite_Document();
if( !$xmlDoc->parseXML$contentsfalsetrue ) ) {
$vmLogger->err'Failed to parse the Currency Converter XML document.');
$_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
return false;
}

$currency_list $xmlDoc->getElementsByTagName"Cube" );
// Loop through the Currency List
for ($i 0$i $currency_list->getLength(); $i++) {
$currNode =& $currency_list->item($i);
$currency[$currNode->getAttribute("currency")] = $currNode->getAttribute("rate");
unset( $currNode );
}
$GLOBALS['converter_array'] = $currency;
}
else {
$GLOBALS['converter_array'] = -1;
//$vmLogger->err( 'Failed to retrieve the Currency Converter XML document.');
$_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
return false;
}
}
return true;
}
/**
 * Converts an amount from one currency into another using
 * the rate conversion table from the European Central Bank
 *
 * @param float $amountA
 * @param string $currA defaults to $vendor_currency
 * @param string $currB defaults to $GLOBALS['product_currency'] (and that defaults to $vendor_currency)
 * @return mixed The converted amount when successful, false on failure
 */
function convert$amountA$currA=''$currB='' ) {
global $vendor_currency;

// global $vendor_currency is DEFAULT!
if( !$currA ) {
$currA $vendor_currency;
}
if( !$currB ) {
$currB $GLOBALS['product_currency'];
}
// If both currency codes match, do nothing
if( $currA == $currB ) {
return $amountA;
}
if( !$this->init()) {
$GLOBALS['product_currency'] = $vendor_currency;
return $amountA;
}
$valA = isset( $GLOBALS['converter_array'][$currA] ) ? $GLOBALS['converter_array'][$currA] : 1;
$valB = isset( $GLOBALS['converter_array'][$currB] ) ? $GLOBALS['converter_array'][$currB] : 1;

$val $amountA $valB $valA;
//$vmLogger->debug('Converted '.$amountA.' '.$currA.' to '.$val.' '.$currB);

return $val;
// end function convertecb
}
?>


----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Adnim

  • Beginner
  • *
  • Posts: 3
Re: Failed to retrieve the Currency Converter XML document
« Reply #8 on: August 19, 2013, 18:15:03 PM »
Thanks stAn99,

Already modified and everything is working.

dutchin

  • Beginner
  • *
  • Posts: 3
Re: Failed to retrieve the Currency Converter XML document
« Reply #9 on: August 23, 2013, 07:29:39 AM »
Dear friends, if you get this error it may be caused by CURL error, insufficient write permissions for the XML file or connection timeout to the ECB server. We've updated the file here:
Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* ECB Currency Converter Module

* @version $Id: convertECB.php 1948 2009-09-30 14:32:48Z soeren_nb $
* @package VirtueMart
* @subpackage classes
* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/

/**
 * This class uses the currency rates provided by an XML file from the European Central Bank
 * Requires cURL or allow_url_fopen
 */
class convertECB {

var $archive true;
var $last_updated '';

var $document_address 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml';

var $info_address 'http://www.ecb.int/stats/eurofxref/';
var $supplier 'European Central Bank';

/**
 * Initializes the global currency converter array
 *
 * @return mixed
 */
function init() {
global $mosConfig_cachepath$mosConfig_absolute_path,
$vendor_currency$vmLogger;

if( !is_array($GLOBALS['converter_array']) && $GLOBALS['converter_array'] !== -) {
setlocale(LC_TIME"en-GB");
$now time() + 3600// Time in ECB (Germany) is GMT + 1 hour (3600 seconds)
if (date("I")) {
$now += 3600// Adjust for daylight saving time
}
$weekday_now_local gmdate('w'$now); // week day, important: week starts with sunday (= 0) !!
$date_now_local gmdate('Ymd'$now);
$time_now_local gmdate('Hi'$now);
$time_ecb_update '1415';
if( is_writable($mosConfig_cachepath) ) {
$store_path $mosConfig_cachepath;
}
else {
$store_path $mosConfig_absolute_path."/media";
}
  
$archivefile_name $store_path.'/daily.xml';
$ecb_filename $this->document_address;
$val '';


if(file_exists($archivefile_name) && filesize$archivefile_name ) > ) {
   // timestamp for the Filename
   $file_datestamp date('Ymd'filemtime($archivefile_name)); 
//stAn, in all cases always load the contents
   $contents = @file_get_contents$archivefile_name );
     // check if today is a weekday - no updates on weekends
     if( date'w' ) > && date'w' ) < 
     // compare filedate and actual date
     && $file_datestamp != $date_now_local
     // if localtime is greater then ecb-update-time go on to update and write files
     && $time_now_local $time_ecb_update) {
     $curr_filename $ecb_filename;
     }
     else {
   $curr_filename $archivefile_name;
     $this->last_updated $file_datestamp;
   $this->archive false;
     }
}
else {
$curr_filename $ecb_filename;
}
  
if( !is_writable$store_path )) {
  $this->archive false;
  $vmLogger->debug"The file $archivefile_name can't be created. The directory $store_path is not writable" );
}
if( $curr_filename == $ecb_filename 
{
// Fetch the file from the internet
require_once( CLASSPATH.'connectionTools.class.php');
$contents_ecb vmConnector::handleCommunication$ecb_filename );
if (empty($contents_ecb))
$contents_ecb = @file_get_contents$ecb_filename );
$this->last_updated date('Ymd');

}

if (!empty($contents_ecb)) $contents $contents_ecb

if( $contents ) {
// if archivefile does not exist
if( $this->archive ) {
// now write new file
file_put_contents$archivefile_name$contents );
}

$contents str_replace ("<Cube currency='USD'"" <Cube currency='EUR' rate='1'/> <Cube currency='USD'"$contents);

/* XML Parsing */
require_once( $mosConfig_absolute_path'/includes/domit/xml_domit_lite_include.php' );
$xmlDoc = new DOMIT_Lite_Document();
if( !$xmlDoc->parseXML$contentsfalsetrue ) ) {
$vmLogger->err'Failed to parse the Currency Converter XML document.');
$_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
return false;
}

$currency_list $xmlDoc->getElementsByTagName"Cube" );
// Loop through the Currency List
for ($i 0$i $currency_list->getLength(); $i++) {
$currNode =& $currency_list->item($i);
$currency[$currNode->getAttribute("currency")] = $currNode->getAttribute("rate");
unset( $currNode );
}
$GLOBALS['converter_array'] = $currency;
}
else {
$GLOBALS['converter_array'] = -1;
//$vmLogger->err( 'Failed to retrieve the Currency Converter XML document.');
$_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
return false;
}
}
return true;
}
/**
 * Converts an amount from one currency into another using
 * the rate conversion table from the European Central Bank
 *
 * @param float $amountA
 * @param string $currA defaults to $vendor_currency
 * @param string $currB defaults to $GLOBALS['product_currency'] (and that defaults to $vendor_currency)
 * @return mixed The converted amount when successful, false on failure
 */
function convert$amountA$currA=''$currB='' ) {
global $vendor_currency;

// global $vendor_currency is DEFAULT!
if( !$currA ) {
$currA $vendor_currency;
}
if( !$currB ) {
$currB $GLOBALS['product_currency'];
}
// If both currency codes match, do nothing
if( $currA == $currB ) {
return $amountA;
}
if( !$this->init()) {
$GLOBALS['product_currency'] = $vendor_currency;
return $amountA;
}
$valA = isset( $GLOBALS['converter_array'][$currA] ) ? $GLOBALS['converter_array'][$currA] : 1;
$valB = isset( $GLOBALS['converter_array'][$currB] ) ? $GLOBALS['converter_array'][$currB] : 1;

$val $amountA $valB $valA;
//$vmLogger->debug('Converted '.$amountA.' '.$currA.' to '.$val.' '.$currB);

return $val;
// end function convertecb
}
?>




it is not work now

kratosNI

  • Beginner
  • *
  • Posts: 1
  • Skype Name: TOROHUACO
Re: Failed to retrieve the Currency Converter XML document
« Reply #10 on: October 09, 2013, 03:01:16 AM »
Hola lo que hize para solucionarlo es que en el archivo administrator/components/com_virtuemart/classes/currency/convertECB.php

cambiar la direccion del banco de esta ---- http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml

sustituirla por esta http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml


y Listo

kaszynek

  • Beginner
  • *
  • Posts: 3
Re: Failed to retrieve the Currency Converter XML document
« Reply #11 on: November 20, 2013, 16:26:51 PM »
The guy above is right. In English:

Edit file: administrator/components/com_virtuemart/classes/currency/convertECB.php
and change the url: http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
to: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

The error is caused due to address change. If you go to http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml you can see that it redirects you to the second address. Probably downloader does not automatically follow redirects, so it is not doing the same as your browser.

Darus

  • Beginner
  • *
  • Posts: 5
Re: Failed to retrieve the Currency Converter XML document
« Reply #12 on: December 18, 2013, 09:40:24 AM »
Hi Everyone,

I've done all the changes as per the thread, but it still does not update to the correct rate. Please help. It seems to be nailed at a rate of about 1 month back.

convertECB.php follows:

<?php
if( !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* ECB Currency Converter Module
*
* @version $Id: convertECB.php 6172 2012-06-28 07:24:53Z Milbo $
* @package VirtueMart
* @subpackage classes
* @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.org
*/

/**
 * This class uses the currency rates provided by an XML file from the European Central Bank
 * Requires cURL or allow_url_fopen
 */
class convertECB {

//    var $archive = true;
//    var $last_updated = '';

   var $document_address = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';

   var $info_address = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
   var $supplier = 'European Central Bank';

   /**
    * Converts an amount from one currency into another using
    * the rate conversion table from the European Central Bank
    *
    * @param float $amountA
    * @param string $currA defaults to $vendor_currency
    * @param string $currB defaults to
    * @return mixed The converted amount when successful, false on failure
    */
//    function convert( $amountA, $currA='', $currB='', $a2b = true ) {
   function convert( $amountA, $currA='', $currB='', $a2rC = true, $relatedCurrency = 'EUR') {

      // cache subfolder(group) 'convertECB', cache method: callback
      $cache= JFactory::getCache('convertECB','callback');

      // save configured lifetime
      @$lifetime=$cache->lifetime;

      $cache->setLifeTime(86400/4); // check 4 time per day

      // save cache conf

      $conf = JFactory::getConfig();

      // check if cache is enabled in configuration

      $cacheactive = $conf->getValue('config.caching');

      $cache->setCaching(1); //enable caching

      $globalCurrencyConverter = $cache->call( array( 'convertECB', 'getSetExchangeRates' ),$this->document_address );

      // revert configuration

      $cache->setCaching($cacheactive);


      if(!$globalCurrencyConverter ){
         //vmdebug('convert convert No $globalCurrencyConverter convert '.$amountA);
         return $amountA;
      } else {
         $valA = isset( $globalCurrencyConverter[$currA] ) ? $globalCurrencyConverter[$currA] : 1.0;
         $valB = isset( $globalCurrencyConverter[$currB] ) ? $globalCurrencyConverter[$currB] : 1.0;

         $val = (float)$amountA * (float)$valB / (float)$valA;
         //vmdebug('convertECB with '.$currA.' '.$amountA.' * '.$valB.' / '.$valA.' = '.$val,$globalCurrencyConverter[$currA]);

         return $val;
      }
   }

   static function getSetExchangeRates($ecb_filename){

         $archive = true;
         setlocale(LC_TIME, "en-GB");
         $now = time() + 3600; // Time in ECB (Germany) is GMT + 1 hour (3600 seconds)
         if (date("I")) {
            $now += 3600; // Adjust for daylight saving time
         }
         $weekday_now_local = gmdate('w', $now); // week day, important: week starts with sunday (= 0) !!
         $date_now_local = gmdate('Ymd', $now);
         $time_now_local = gmdate('Hi', $now);
         $time_ecb_update = '1415';
         if( is_writable(JPATH_BASE.DS.'cache') ) {
            $store_path = JPATH_BASE.DS.'cache';
         }
         else {
            $store_path = JPATH_SITE.DS.'media';
         }

         $archivefile_name = $store_path.'/daily.xml';

         $val = '';


         if(file_exists($archivefile_name) && filesize( $archivefile_name ) > 0 ) {
              // timestamp for the Filename
              $file_datestamp = date('Ymd', filemtime($archivefile_name));

                // check if today is a weekday - no updates on weekends
                if( (date( 'w' ) > 0 && date( 'w' ) < 6)
                   // compare filedate and actual date
                   && ($file_datestamp != $date_now_local
                   // if localtime is greater then ecb-update-time go on to update and write files
                   || (($file_datestamp == $date_now_local
                      && $time_now_local > $time_ecb_update))))
                {
                   $curr_filename = $ecb_filename;   
                }
                else {
               $curr_filename = $archivefile_name;
                   $this->last_updated = $file_datestamp;
               $this->archive = false;
                }
         }
         else {
            $curr_filename = $ecb_filename;
         }

         if( !is_writable( $store_path )) {
            $archive = false;
            vmError( "The file $archivefile_name can't be created. The directory $store_path is not writable" );
         }
         //         JError::raiseNotice(1, "The file $archivefile_name should be in the directory $store_path " );
         if( $curr_filename == $ecb_filename ) {
            // Fetch the file from the internet
            if(!class_exists('VmConnector')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'connection.php');
            //            JError::raiseNotice(1, "Updating currency " );
            if (!$contents = VmConnector::handleCommunication( $curr_filename )) {
               if (isset($file_datestamp)) {
                  $contents = @file_get_contents( $curr_filename );
               }
            } else $last_updated = date('Ymd');

         }
         else {
            $contents = @file_get_contents( $curr_filename );
         }
         if( $contents ) {
            // if archivefile does not exist
            if( $archive ) {
               // now write new file
               file_put_contents( $archivefile_name, $contents );
            }

            $contents = str_replace ("<Cube currency='USD'", " <Cube currency='EUR' rate='1'/> <Cube currency='USD'", $contents);

            /* XML Parsing */
            $xmlDoc = new DomDocument();

            if( !$xmlDoc->loadXML($contents) ) {
               //todo
               vmError('Failed to parse the Currency Converter XML document.');
               vmError('The content: '.$contents);
               //               $GLOBALS['product_currency'] = $vendor_currency;
               return false;
            }

            $currency_list = $xmlDoc->getElementsByTagName( "Cube" );
            // Loop through the Currency List
            $length = $currency_list->length;
            for ($i = 0; $i < $length; $i++) {
               $currNode = $currency_list->item($i);
               if(!empty($currNode) && !empty($currNode->attributes->getNamedItem("currency")->nodeValue)){
                  $currency[$currNode->attributes->getNamedItem("currency")->nodeValue] = $currNode->attributes->getNamedItem("rate")->nodeValue;
                  unset( $currNode );
               }

            }
            $globalCurrencyConverter = $currency;
         }
         else {
            $globalCurrencyConverter = false;
            vmError( 'Failed to retrieve the Currency Converter XML document.');
//             return false;
         }

         return $globalCurrencyConverter;
   }

}
// pure php no closing tag


Ver: JM2.5
VM2.0.26

vargpr

  • Beginner
  • *
  • Posts: 40
Re: Failed to retrieve the Currency Converter XML document
« Reply #13 on: January 27, 2014, 17:20:41 PM »
    FTP’ed to the clients host and downloaded the following file.
    administrator/components/com_virtuemart/classes/currency/convertECB.php
    Opened it in dreamweaver and edited line 57.

    var $document_address = ‘http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml’;

    to be

    var $document_address = ‘http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml’;

After that I didn’t get the error

alexxsav

  • Beginner
  • *
  • Posts: 23
Re: Failed to retrieve the Currency Converter XML document
« Reply #14 on: May 25, 2015, 18:26:00 PM »
Hello All. Thanks for topic.
I have small question. I have some plugin and want to use function convert from this object or get currency rate. How i can call this?