I'm trying to implement the 2nd solution from philwinkle in this post: Price(float number) in transactional email

I have my folder setup like so: app/code/local/Anja/EmailModule/Model/Email/Template with the file Filter.php

The content of this file is:

 class Anja_EmailModule_Model_Email_Template_Filter extends Mage_Core_Model_Email_Template_Filter
    public function __construct()
        $this->_modifiers['formatCurrency'] = array($this, 'modifierFormatCurrency');

    public function modifierFormatCurrency($var)
        return Mage::helper('core')->currency($var,false,false) . " Test";

but it doesn't appear to get processed at all by Magento. I have cleared cache and recompiled, but in the output not even the word Test gets displayed. What am I doing wrong? Do I also need an xml file somewhere?

Edit after some googling I find that I just want to extend the class. I have 2 xml files app/etc/modules/Anja_EmailModule.xml

<?xml version="1.0"?>


and in app/local/Anja/EmailModule/etc/config.xml

<?xml version="1.0"?>


from this example: http://www.codexpedia.com/magento/how-to-extend-a-model-class-and-overrides-its-functions-in-magento/

I still don't see the word "Test" in my email.

1 Answer 1


If you haven't done so, you have to include the rest of the entire custom module. Not just this one file.

You'll need the config.xml, the app/etc/module/modulename.xml, and any support model files and such.

I suggest you look at inchoo or atwix for help creating a magento module. They are online sites that have lots of information about doing things like this.

A quick google search turned up a hello world module to get you going.... Build something simple that works, then modify it to do what you want.



In your config.xml add

You have to determine what event you want to observe, put that into the xml file, and then you put the method name in there. You have to determine what event you want to observe, put that into the xml file, and then you put the method name in there.


then, in /Companyname/ModuleName/Model folder (you create this) add a file called Observer.php

in this, you add

class Companyname_ModuleName_Model_Observer {
    public function yourMethodNameHere() { echo "DID IT"; };


This will fire on every page load. controller_front_init_router runs every time.

  • I got the HelloWorld module going. Do you know what I need to put in the xml file to make the method formatCurrency work? Since I don't need to trigger it but it needs to be parsed in the core before the email is sent. I know the method works because if I hack it into the core Filter file, it works (I removed the code after)
    – Robin
    Feb 17, 2015 at 13:56
  • updated my answer to reflect your question. The hello world module doesn't implement an observer.
    – CarComp
    Feb 17, 2015 at 16:32
  • After some googling I see there are 2 ways to achieve what I want, I'm looking to just extend the Filter class, I don't think I have to implement an observer for that? I updated my question with my xml files
    – Robin
    Feb 18, 2015 at 14:21
  • I tried your solution with an observer as well but still nothing, I don't see the text anywhere.
    – Robin
    Feb 19, 2015 at 13:14

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.