Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Sign in to follow this  

auto currancy update issue

Recommended Posts

i have a site which has 3 currancies installed


GBP (default) USD and EUR


i added the code from add on contribution




and now i get an error


the code from the contribution added to - APPLICATION_TOP.PHP in INCLUDES folder




// Update Currency Rate


# Read currency exchanges rates

# Cache file if appropriate ...

if (time()-filemtime("eurofxref-daily.xml") > 36000) {

$stuff = file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");

$fh = fopen("eurofxref-daily.xml","w");

foreach ($stuff as $line) { fputs($fh,$line); }

fclose ($fh);

$xld = "loaded afresh (and not cached)";

} else {

# .. or read from cache

$stuff = file("eurofxref-daily.xml");

$xld = "cached (and not loaded afresh)";


# $xld may be used in your output to inform you user or admin

# Extract exchange rates

$exchrate[EUR] = 1.00;

foreach ($stuff as $line) {


if (ereg("rate='([[:graph:]]+)'",$line,$gotb)) {

$exchrate[$gota[1]] = $gotb[1];




$GBP_EUR = round(1 * $exchrate[GBP], 8);

$GBP_USD = round(1 * $exchrate[uSD], 8);


tep_db_query("update currencies set value = ". $GBP_EUR ." where code = 'GBP'");


tep_db_query("update currencies set value = ". $GBP_USD ." where code = 'USD'");



when i installed this and tried, the error i got was


Fatal error: Call to undefined function tep_db_query() in /data/www/vhosts/MYWEBSITE.com/httpdocs/includes/application_top.php on line 71


LINE 71 was


tep_db_query("update currencies set value = ". $GBP_EUR ." where code = 'GBP'");


any ideas anyone as i could do with site update automatically all the time





Share this post

Link to post
Share on other sites

That function is a stock function in oscommerce but that error is saying it can't be found. So either there is some coding mistake in the contribution, a mistake was made in the installation or sometihng is wrong with your shop. I suggest you try this one instead.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this