ylliX - Online Advertising Network

Send pdf automatically when invoice is created in Magento

It is a bit different then method showed in previous post – this time its not transactional email sent at demand, but we will catch event fired after invoice is generated. So (I suppose you have your module already) in etc/config.xml add:


Then create your class at app/code/local/YourVendor/YourModule/Model/Observer.php (or use existing one) and add new method:

public function sendInvoice($observer) {
	try {
		/* @var $order Magento_Sales_Model_Order_Invoice */
		$invoice = $observer->getEvent()->getInvoice();
	} catch (Mage_Core_Exception $e) {
		Mage::log("Error: " . $e->getMessage());
	return $this;

And invoice will be attached to email defined at:

Zrzut ekranu 2015-01-14 o 19.12.17

Leave a Reply