Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

automatic currency exchange rate update for 2.0? Rate Topic   - - - - -

 
  • ogia
  • Senior Member
  • Members
  • Join Date: 09-Aug 09
  • 503 posts

Posted 07 September 2009 - 08:06 AM #1

I found this thread where a solution is discussed for 1.x
http://forum.cs-cart...onversion rates

Is there anything available or in the works for 2.0?
CS-Cart 2.1.3 | Selling downloads
I recommend Newsletter Integration with Mailchimp

 
  • ThomH
  • Senior Member
  • Members
  • Join Date: 20-Nov 07
  • 1582 posts

Posted 08 September 2009 - 06:39 AM #2

Live Currency Rates - Pro v2

WebGraphiq offers a wide range of professionally developed, ready to use CS-Cart add-ons to provide additional functionality and boost your sales. The oldest active CS-Cart add-on development team. -- Since 2006 --


CS-CART ADD-ONS | FREE QUOTE | CS-CART DEVELOPMENT | @webgraphiq


 
  • ogia
  • Senior Member
  • Members
  • Join Date: 09-Aug 09
  • 503 posts

Posted 08 September 2009 - 04:23 PM #3

Thanks! 8-)
CS-Cart 2.1.3 | Selling downloads
I recommend Newsletter Integration with Mailchimp

 
  • domfang
  • Junior Member
  • Members
  • Join Date: 06-Feb 10
  • 15 posts

Posted 07 February 2010 - 05:56 PM #4

I have developed a script to automatically update currency exchange rate for my CS-CART store:

Swimwear Place


If you can add a back link to my website on your website, I can provide you the script free of charge.

 
  • mifzal
  • Senior Member
  • Trial users
  • Join Date: 20-Oct 11
  • 190 posts

Posted 11 July 2012 - 04:30 AM #5

I have developed a script to automatically update currency exchange rate for my CS-CART store:

Swimwear Place


If you can add a back link to my website on your website, I can provide you the script free of charge.


Please help me to add currency converter to my site at www.onlineam.com

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11664 posts

Posted 11 July 2012 - 10:38 PM #6

You can use this code:
<?php
/**
 **    Usage: Use the root of your store as the working directory for CRON
 ** Use this command line: php ./addons/my_changes/update_currencies.php --pw=<password>
 **        where <password> is the password used for password reminders in Administration/Settings/Security Settings
 **/
define('AREA', 'A');
define('AREA_NAME', 'admin');
if( !file_exists('./prepare.php') )
    chdir('../..');
require_once("./prepare.php");
require_once("./init.php");

define("RUN_FROM_CRON", empty($_REQUEST['i']) ? true : false);
define("UPDATE_DB", true);

if( RUN_FROM_CRON ) {
    $cron_password = Registry::get('settings.Security.cron_password');
    if( !$cron_password )
        die('Bad pass');
    
    if ((!isset($_REQUEST['pw']) || $cron_password != $_REQUEST['pw']) ) {
        die(fn_get_lang_var('access_denied'));
    }
}

define('cur_host', 'www.webservicex.net');
define('cur_url', cur_host."/CurrencyConvertor.asmx/ConversionRate");
define('cur_from', 'FromCurrency=');
define('cur_to', 'ToCurrency=');

function cur_get_rate($cur) {
//    $request = cur_url."?".cur_from.$cur."&".cur_to.CART_PRIMARY_CURRENCY;
    $request = cur_url."?".cur_to.$cur."&".cur_from.CART_PRIMARY_CURRENCY;
    list($header, $response) = fn_http_request('GET', $request);
    $v = preg_replace('/.*>([0-9]\.[^<]*).*/is', '$1', $response);
    if( is_numeric($v) )
        return $v;
    return Registry::get('currencies.'.$cur."coefficient");
}

$currencies = Registry::get('currencies');

echo "<pre>";
foreach($currencies as $currency => $data) {
    if( $currency == CART_PRIMARY_CURRENCY )
        continue;
    $old = $data['coefficient'];
    $data['coefficient'] = cur_get_rate($currency);
    if( UPDATE_DB )
        db_query("UPDATE ?:currencies set coefficient=?d WHERE currency_code=?s", $data['coefficient'], $currency);
    echo "$currency updated from $old to $data[coefficient]\n";
}
echo "</pre>";
exit;
    
?>

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.