I'm creating a new module for allowing me to work with currency exchanges. For doing this I'm extending this class:


Overriding this method:

abstract protected function _convert($currencyFrom, $currencyTo);

Now that my module is installed, I don't know how I can call this method from my checkout classes. I want to convert some prices.

I could call it using:

Mage::getModel('my_currencyconverter/my_model')->_convert('USD', 'EUR');

But I had to change first that previous function visibility, from protected to public.

How do I use this new function?

2 Answers 2


If you need to use the method outside the object it must be a public function not a protected as started in the abstract class.

But when you are extending a class with abstract methods it means you have to define them yourself them yourself.

If you have decleared it however, define a public function that can call the code

public function convert($from, to)
    return $this->_convert($from, $to);

And then call the method convert on your object.


Create in your model a public method that's a wrapper for the protected one.

public function convert($from, $to)
    return $this->_convert($from, $to);

Then call the convert method on your code:

Mage::getModel('my_currencyconverter/my_model')->convert('USD', 'EUR');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.