Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

help on error when I call currency->format in easypopulat


Recommended Posts

I have added the following line to the easy populate to convert the price from euro to usd, but I am getting an error. I am not an php guru so can some one have a quick look at the code and see if there is a glaring error.


in the file easypopulate I have added.






require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();





$shop_base_currency = "EUR";





case 'froogle':...

echo "froogle prices ";

echo "<br> Euro Price = $v_products_price";

---> $v_products_price = $currencies->format($v_products_price, true, $shop_base_currency ,USD);

echo "<b> USD Price = $v_products_price </b>";




I am getting the following error on the line with the arrow.


froogle prices

Euro Price =


Fatal error: Call to a member function on a non-object in /usr/hsphere/local/home/mcevoys/mcevoys.ie/admin/easypopulate2.php on line 1165


As far as I can see I am calling the format currency function correctly but there is some thing else I am missing.


help is appreciated, thanks for taking the time to read my posting




Sean Owens

free is often better than cheap

Link to comment
Share on other sites



I think that your line 1165 would fit in around line 1070 on my fresh download of EP 2.6. Line 930 on mine is

function ep_create_filelayout($dltype){

which starts a function that continues through line 1151. The froogle case is on line 1065. On my line 303, I have the require for application_top.php. I'm guessing that your code works similarly. However, if that is so, then $currencies is being defined outside the function's scope. Unlike C (et.al.), PHP does not automatically allow access to global variables inside of other scopes. Thus, I suspect that it thinks that the $currencies variable that calls the is a *different* variable than ithe one defined by the requires.


There are two ways that I can see to fix this: one, move the initial declaration of $currencies into the function, which would be the preferred place to have it if you do not use it in other functions; two, if you are using it in other functions, add a

global $currencies;

at the beginning of the function. Of course, maybe I'm misreading your code. Let us know what you find out.




I love deadlines. I like the whooshing sound they make as they fly by. ---Douglas Adams

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...