I tried running the api function from the Execute php console in devel and from the template.php in my theme but both results in the same:
Fatal error: Call to undefined function currency_api_exchange() in E:\xampp\htdocs\mysites\cwlabs\clearwind-group\sites\all\modules\devel\devel.module(1036) : eval()'d code on line 1

I'm not sure if the api function is supposed to be only available in modules? because I would like to use it in a theme. The other 2 api functions _did_ work from the devel console and template.php.

This website is currently using Drupal 6.9 and currency 6.x-1.1

Comments

jurriaanroelofs’s picture

Component: Code » Documentation

Ok, found the problem.

The documentation of the API describes 2 functions that can be used for currency conversion:
function currency_api_exchange($currency_from, $currency_to, $amount = 1)

And

* Here is an example on how to use it:
*
* $from = 'CAD';
* $to = 'USD';
* $amt = 20;
* $ret = currency_exchange($from, $to, $amt);

Both of these are wrong, the funcion is actually called currency_api_convert();
I had to read the module code to find that out, so the documentation is not very helpful here ;)

ferrangil’s picture

Status: Active » Fixed

Yes, the documentation was wrong. Now it's fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.