0

in My/Stuff/etc/config.xml

<global>
    <models>
        <newsletter>
            <rewrite>
                <subscriber>My_Stuff_Model_Subscriber</subscriber>
            </rewrite>
        </newsletter>
    </models>
 (...)

in My/Stuff/Model/Subscriber.php

class My_Stuff_Model_Subscriber extends Mage_Newsletter_Model_Subscriber {

    public function sendConfirmationSuccessEmail()
    {
        Mage::Log('My_Stuff_Model_Subscriber::sendConfirmationSuccessEmail()');
    }
}

Mail was send but why is sendConfirmationSuccessEmail() not triggered?

My workaround is to copy Mage_Newsletter_Model_Subscriber to local and that works but override should be cleaner.

  • Please double, no triple check if the model is not overwritten by another extension already. Happened to me once, spent an hour 'debugging' to find out some obscure, small extension was already messing with it – Sander Mangel Sep 24 '13 at 10:02
  • @SanderMangel Thanks, I didn't know that could be a problem. Is there an easy way to check this? What can I do if another model is messing with it? – PiTheNumber Sep 24 '13 at 10:07
  • @PiTheNumber You can use n98-magerun for this, if you don't have it. then you can easily install it from magento-quickies.tumblr.com/post/47974204176/… – Anshu Mishra Sep 24 '13 at 10:31
  • 3
    Trey and search in the community and local codepool directories for the <newsletter> tag. That should work pretty well – Sander Mangel Sep 24 '13 at 10:37
  • 2
    Create a php script: test.php (in document root) and do a Mage::app() then $model = Mage::getModel('newsletter/subscriber'); echo get_class($model); to check if your rewrite works. – FlorinelChis Sep 24 '13 at 15:01
1

When ever I am dealing with overrides not working I do the following to check.

  1. Validate that my extension appears in the admin list under:

    System->Configuration->Advanced->Advanced->Disable Modules Output

  2. Temporarily add the overridden class in the index.php and echo out it's class

    var_dump(get_class(Mage::getModel('newsletter/subscriber')));

  3. Double check that you are using the correct code pool. Validate that if you are using the codePool local that your class is actually in local.

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.