syscon Posted June 27, 2003 Share Posted June 27, 2003 I have the same strange problem. I've install the same MS1 snapshot on two computers. I can update the currency every-time on one computer but not on the other. Joseph #Joseph Link to comment Share on other sites More sharing options...
syscon Posted June 27, 2003 Share Posted June 27, 2003 This is utterly baffling... it must be a snapshot issue. If anyone can make the currency update work (or not work, as the case maybe), can they post what snapshots they are using? This may solve the problem! Cheers in advance.... Angurio.. I don't think it is a snapshot issue. I have two computers one running Mandrake 9.0 the other one running Mandrake 9.1, both are behind the same firewall. I'm using the same snapshot MS1 on both computers. Snapshot running on Mandrake 9.0 will not update the currency. Snapshot running on Mandrake 9.1 will update. Now the question is why??!! It is not critical but puzzling :?: Joseph #Joseph Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2003 Share Posted June 27, 2003 Hey everyone, Running into the same problem here. I'm using the current MS1 freshly downloaded. As some people have suggested in this thread, I've downloaded the latest snapshot and exchanged the currencies.php files (after making backups :!: of course). This did not work for me and I'm still getting the following errors when I try to update: Warning WARNING_PRIMARY_SERVER_FAILED Error ERROR_CURRENCY_INVALID Warning WARNING_PRIMARY_SERVER_FAILED Error ERROR_CURRENCY_INVALID Running on Debian (sid and woody) systems although I doubt this has anything to do with it. Made backups of these MS1 files and replaced them with the files shown below in the Snapshot. MS1 ./includes/boxes/currencies.php ./includes/classes/currencies.php ./admin/currencies.php ./admin/includes/classes/currencies.php ./admin/includes/languages/english/currencies.php ./admin/includes/languages/espanol/currencies.php ./admin/includes/languages/german/currencies.php Snapshot (tep_snapshot-20030626) ./admin/admin/currencies.php ./admin/admin/includes/classes/currencies.php ./admin/admin/includes/languages/english/currencies.php ./admin/admin/includes/languages/espanol/currencies.php ./admin/admin/includes/languages/german/currencies.php ./catalog/catalog/includes/boxes/currencies.php ./catalog/catalog/includes/classes/currencies.php Link to comment Share on other sites More sharing options...
Harald Ponce de Leon Posted June 27, 2003 Share Posted June 27, 2003 The admin/includes/functions/localization.php needs to be copied from current CVS too. , osCommerce Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2003 Share Posted June 27, 2003 Hey Harald, Thanks! It is again updating successfully! The exchange rate for US Dollar (USD) was updated successfully via oanda. The exchange rate for Canadian Dollar (CAD) was updated successfully via oanda. For everyone else.. by updating the 7 currencies.php files (which are listed above) and the localization.php file as pointed out by Harold above things should be working again for you. Link to comment Share on other sites More sharing options...
jloyzaga Posted June 29, 2003 Share Posted June 29, 2003 did as suggested and got - can anyone tell me what to do? Warning: file(http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=DEM&format=CSV&dest=Get+Table&sel_list=AU) [function.file]: failed to create stream: HTTP request failed! g???f?? in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 14 Warning: implode() [function.implode]: Bad arguments. in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 18 Warning: file(http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=ESP&format=CSV&dest=Get+Table&sel_list=AU) [function.file]: failed to create stream: HTTP request failed! g???f?? in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 14 Warning: implode() [function.implode]: Bad arguments. in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 18 Warning: file(http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=EUR&format=CSV&dest=Get+Table&sel_list=AU) [function.file]: failed to create stream: HTTP request failed! g???f?? in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 14 Warning: implode() [function.implode]: Bad arguments. in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/localization.php:14) in /home/hsphere/local/home/arkmusic/arkmusic.com.au/admin/includes/functions/general.php on line 18 Link to comment Share on other sites More sharing options...
halbert Posted July 4, 2003 Share Posted July 4, 2003 I too found my currency update stopped working when I checked it today (july 3). :( I'm running CVS 2.2 5-18-03. I got the error messages as per below: Error: The exchange rate for US Dollar (USD) was not updated. Is it a valid currency code? Error: The exchange rate for Euro (EUR) was not updated. Is it a valid currency code? I updated my currencies.php files as the previous messages using snapshot 7-2-03. Now I'm getting errors: Warning: sprintf(): too few arguments in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php on line 77 Warning: sprintf(): too few arguments in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php on line 77 Warning: sprintf(): too few arguments in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php on line 77 Warning: sprintf(): too few arguments in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php on line 77 Warning: sprintf(): too few arguments in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php on line 77 Warning: Cannot add header information - headers already sent by (output started at /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/currencies.php:77) in /www/bcwebnet.com/customer_dir/frozenbert/www.frozenlightning.com/catalog/admin/includes/functions/general.php on line 21 Any suggestions?? -al Link to comment Share on other sites More sharing options...
halbert Posted July 4, 2003 Share Posted July 4, 2003 Okay, never mind... I went to Sourceforge and grabbed the newest versions of the currency files in question. It now works. :D I put the files here if you want to download them: www.frozenlightning.com/oscforums/currencyfiles7-2-03.zip -al Link to comment Share on other sites More sharing options...
Guest Posted July 4, 2003 Share Posted July 4, 2003 Allan, Could you amend your link, it does not work. Thanks. Jeff. Link to comment Share on other sites More sharing options...
halbert Posted July 4, 2003 Share Posted July 4, 2003 Oops, server error... should be working now. -al Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2003 Share Posted July 5, 2003 FWIW, you may not need to upload all of the files. Since I auto update my exchange rates daily the only thing that needed to be changed to make it work properly was to update the function used to get the information from the currency servers. I just changed the old code that looked like this: admin/includes/functions/localization.php function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) { $err_num = ''; $err_msg = ''; $s = fsockopen('www.oanda.com', 5011, $err_num, $err_msg, 5); if (!$s) { $resp = 'na'; // prevent breaking script } else { fputs($s, "fxp/1.1rnbasecurrency: $codernquotecurrency: $basernrn"); $resp = fgets($s, 128); if (trim($resp) == "fxp/1.1 200 ok") { while ($resp != "rn") { $resp = fgets($s, 128); } if (!$resp = fgets($s, 128)) { // timeout? then skip $resp = 'na'; } } else { $resp = 'na'; } fclose($s); } if ($resp == 'na') { return false; } return trim($resp); } function quote_xe_currency($to, $from = DEFAULT_CURRENCY) { $regex = "/[0-9.]+s*$froms*=s*([0-9.]+)s*$to/"; $return = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); while (list(, $line) = each($return)) { if (preg_match($regex, $line, $match)) { break; } } if (!isset($match)) { return false; } return $match[1]; } New functions were apparantly needed so were changed to this: function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) { $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base); $match = array(); preg_match('/(.+),(w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match); if (sizeof($match) > 0) { return $match[3]; } else { return false; } } function quote_xe_currency($to, $from = DEFAULT_CURRENCY) { $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); $match = array(); preg_match('/[0-9.]+s*' . $from . 's*=s*([0-9.]+)s*' . $to . '/', implode('', $page), $match); if (sizeof($match) > 0) { return $match[1]; } else { return false; } } Link to comment Share on other sites More sharing options...
Guest Posted July 6, 2003 Share Posted July 6, 2003 Thanks Justin... that worked for me... all that was needed on MS1 :wink: Link to comment Share on other sites More sharing options...
GKN Posted July 18, 2003 Share Posted July 18, 2003 Hi All, Not sure if anyone is still having currency conversion problems ?, below is a solution which I have been using... I have made a small changes to admincurrencies.php adminincludeslanguagesenglishcurrencies.php but nothing too involved. Xe.com have a FREE currency update service. goto http://www.xe.com/cus/ and fillout the top section of the form. Make sure you set the 'Base currency for your mailout' to you Default currency. Once you confirm registration you will recieve an email from xe.com each day containing the currency rates. When I want to update my currency rates all I do is save the 'rates table' portion of the email to a text file and upload it to the server into the osc admin area. Then go into Admin -> Currencies and click the update currencies button. Yes, I have changed the code behind the 'update currencies' button. edit the: adminincludeslanguagesenglishcurrecies.php at the bottom of the file add: define('CURRENCY_DATA_FILE','currencydata.txt'); this just defines the name of the text file. Next edit: admincurrencies.php find the line case 'update': delete all the lines between this line and case 'delete': Next paste in the following: // Read Data file and fill array if (file_exists(CURRENCY_DATA_FILE)){ $fp = fopen(CURRENCY_DATA_FILE, "r"); $data = ""; $curr_data_array = array(); while(!feof($fp)){ $data = fgets($fp, 4096); $curr_data_array[] = array('code' => substr($data,0,3) , 'desc' => substr($data,4,28) , 'perUnit' => substr($data,35,20), 'Unitper' => substr($data,57,20) ); } // fetch all currencies from oSC $currency_query_raw = "select currencies_id, code from " . TABLE_CURRENCIES . ""; $currency_query = tep_db_query($currency_query_raw); while ($currency = tep_db_fetch_array($currency_query)) { foreach ($curr_data_array as $key => $ArrayRow){ // Look for the value from the $currency array. stop looking when found if ($ArrayRow['code'] == $currency['code']){ tep_db_query("update " . TABLE_CURRENCIES . " set value = '" . $ArrayRow['Unitper'] . "', last_updated = now() where currencies_id = '" . $currency['currencies_id']. "'"); break; } } } }else{ $messageStack->add('Cannot find file: ' .CURRENCY_DATA_FILE , 'error'); } break; thats it. If you try this please... back up your original files before making any changes have requested the currencies email from xe.com in the correct base currency. Hope this helps, any questions get in touch. Cheers G. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.