Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Jan 2004
    Posts
    58,459
    Blog Entries
    3
    Plugin Contributions
    111

    Default Re: Update currencies from timegenie.com's xml feed

    It appears that BOC has changed their data feeds.
    Code:
    function quote_boc_currency($currencyCode = '', $base = DEFAULT_CURRENCY)
    {
      if ($currencyCode == $base) return 1;
      static $CSVContent;
      $requested = $currencyCode;
      $url = 'http://www.bankofcanada.ca/stats/assets/csv/fx-seven-day.csv';
      $currencyArray = array();
      $currencyArray['CAD'] = 1;
      if (!isset($CSVContent) || $CSVContent == '') {
        $CSVContent = file($url);
        if (! is_object($CSVContent) && function_exists('curl_init')) {
          $CSVContent = doCurlCurrencyRequest('GET', $url);
          $CSVContent = explode("\n", $CSVContent);
        }
      }
      foreach ($CSVContent as $line) {
        if (substr($line, 0, 1) == '#' || substr($line, 0, 4) == 'Date' || trim($line) == '') continue;
        $data = explode(',', $line);
        $curName = $data[1];
        $curRate = $data[sizeof($data)-1];
        $currencyArray[trim($curName)] = (float)$curRate;
      }
      $rate = (string)($currencyArray[DEFAULT_CURRENCY]/(float)$currencyArray[$requested]);
      return $rate;
    }

    These updates will be in v1.5.1
    Last edited by DrByte; 12 Feb 2012 at 08:20 PM. Reason: typo
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #12
    Join Date
    Feb 2009
    Posts
    240
    Plugin Contributions
    0

    Default Re: Update currencies from timegenie.com's xml feed

    Thank you, that works well.

    Having carried out some checks on the updated exchange rates I see that the Boc values in 'fx-seven-day.csv' are not referenced to one currency such as CAD but give the value in CAD for 1 unit of each countries' currency. i.e. from the .csv, 1 Croatian Kuna = 0.1741 CAD, what zen cart needs is 1 CAD = 5.7408 Croatian Kuna. Therefore the reciprocal values of the Boc supplied exchange rates are required.

    Perhaps this calculation can be incorporated into the code somewhere. If not I may have to do without that source.

  3. #13
    Join Date
    Jan 2004
    Posts
    58,459
    Blog Entries
    3
    Plugin Contributions
    111

    Default Re: Update currencies from timegenie.com's xml feed

    grr - I'd posted the wrong update. Corrected above.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #14
    Join Date
    Feb 2009
    Posts
    240
    Plugin Contributions
    0

    Default Re: Update currencies from timegenie.com's xml feed

    Thank you for sorting all this out.

    I can report that the Timegenie, Boc & Ecb feeds are all working and that Zen Cart is able to populate, from free sources, the exchange rates for 61% of the world's currencies.

  5. #15
    Join Date
    Jan 2004
    Posts
    58,459
    Blog Entries
    3
    Plugin Contributions
    111

    Default Re: Update currencies from timegenie.com's xml feed

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #16
    Join Date
    Jan 2013
    Posts
    1
    Plugin Contributions
    0

    Default Re: Update currencies from timegenie.com's xml feed

    Hi Dr Byte
    I am new here. I try to put more than one currencies in my website to show the price in different currency. I notice it does not update the exchange rate automatically, then I download your currency timegenie 150 and plugin to my admin folder. also I put a tat in my side "source timegenie.com", I still can not make it work . I have try to make the default currency either USA or AUD. Can you help ?

  7. #17
    Join Date
    Sep 2010
    Posts
    580
    Plugin Contributions
    0

    Default Re: Update currencies from timegenie.com's xml feed

    Quote Originally Posted by DrByte View Post
    Hello! Thank you for providing this mod! I just have a question. Does it update the rates automatically within the admin section or do I need to do anything else?

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. My currencies update is way out!
    By BREZ in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 7
    Last Post: 28 Nov 2008, 04:54 AM
  2. Update currencies
    By enquirer66 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 5
    Last Post: 23 Apr 2008, 11:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •