1

This is my config xml from my custom module:

<models>
    <emailtester>
         <rewrite>
             <variable>Mynamespace_Mymodule_Model_Mailer_Variable</variable>
         </rewrite>
    </emailTester>
</models>

This is my model:

class Mynamespace_MyModule_Model_Mailer_Variable extends Yireo_EmailTester_Model_Mailer_Variable
{
    public function getVariables()
    { 
         echo 1; exit();
    }

}

I would like to overwrite the method: Yireo_EmailTester_Model_Mailer_Variable::getVariables

This is the Yireo_EmailTester class:

class Yireo_EmailTester_Model_Mailer_Variable extends Varien_Object
{
    .....
    public function getVariables()
    {
    ....
    }
}

I am not sure what I am doing wrong here. I followed this Overwrite community Model file? , but still I cannot get the echo 1; exit(); Any idea why ?

Thank you!

  • try changing <variable> to <mailer_variable> in config.xml under <rewrite> tag – Piyush Feb 22 '18 at 11:08
  • @Piyush that was it . Thnx. you can post it as an answer, I will accept it :) with some explication why use mailer_variable instead of variable – Attila Naghi Feb 22 '18 at 11:12
1

You have wrong code in your config.xml, you should have below code

<models>
    <emailtester>
         <rewrite>
             <mailer_variable>Mynamespace_Mymodule_Model_Mailer_Variable</mailer_variable>
         </rewrite>
    </emailTester>
</models>

node after the <rewrite> is the path of you model file after Model directory. In your case you are rewriting Yireo_EmailTester_Model_Mailer_Variable file so it will be mailer_variable

  • 1
    Typo there, variable_mailer should be mailer_variable ;) – Raul Sanchez Feb 22 '18 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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