Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

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





Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...