0

I want to implement an pdf attachment to my invoice mail to the customer. I have a pretty good guess on how to do that, however this time I would like to solve the task with an event observer.

Not having worked much with Magento Observers before, I have some troubles figuring out which event to hook into.

What I need is an event which happens when the standard email is composed, so that I can simply attach my pdf copy of the invoice. Funnily enough all the helpful sites I found on the internet omit exactly on explaining that step in order to keep the tutorial generic or something.

Any hint about the event, or even better on a generic way to figure out the right event to use in any task, would be greatly appreciated. Thank you.

2
  • You ,you check this link bluehorse.in/blog/…
    – Amit Bera
    Commented Jul 1, 2014 at 10:12
  • Thanks for the link. Looks like this one uses the rewrite approach, though. I might have to resort to that, so I appreciate the hint. Commented Jul 1, 2014 at 10:33

2 Answers 2

0

Afaik there is still no event in the while mailing system of magento. Neither in Mage_Core_Model_Email_Template nor in Mage_Core_Model_Email therefore you have to do what Samir is part 3 to rewrite the sending class add your own event and register an observer on it or just rewrite the class and add your attachement directly.

You should checkout Fooman_EmailAttachments: https://github.com/fooman/emailattachments

@fooman adds the events here app/code/community/Fooman/EmailAttachments/Model/Core/Email/Template/Mailer.php

1
  • That'll do. Thanks for pointing me the way. Commented Jul 1, 2014 at 12:10
0
  1. check the modules if you can find there something like 'dispatch' or observer
  2. to get an overview use the search from your ide with 'dispatch' or Observer
  3. If you cant find anything you can create your own observer, and add the dispatch where you need it by overriding the Model(s) in your custom module
1
  • Thanks, I guess I shouldn't have expected a less effortful way to figure the events out. It's Magento after all ;) Commented Jul 1, 2014 at 12:09

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.