Last active
August 29, 2015 14:02
-
-
Save mhhansen/22a16b7c333d775fb486 to your computer and use it in GitHub Desktop.
MageMonkey Mandrill + WebShopApps PDF Invoicing : Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Webshopapps_Invoicing | |
* File: app/code/community/Webshopapps/Invoicing/Sales/Model/Order/Invoice.php | |
* | |
* Change addAttachment() function at the end of the file, to use this content | |
*/ | |
public function addAttachment($mailTemplate,$pdf, $filename) { | |
$file=$pdf->render(); | |
$mailTemplate->getMail()->createAttachment( | |
$file, | |
'application/pdf', | |
Zend_Mime::DISPOSITION_ATTACHMENT, | |
Zend_Mime::ENCODING_BASE64, | |
$filename | |
); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Webshopapps_Invoicing | |
* File: app/code/community/Webshopapps/Invoicing/Sales/Model/Order.php | |
* | |
* Change addAttachment() function at the end of the file, to use this content | |
*/ | |
public function addAttachment($mailTemplate,$pdf, $filename) { | |
$file=$pdf->render(); | |
$mailTemplate->getMail()->createAttachment( | |
$file, | |
'application/pdf', | |
Zend_Mime::DISPOSITION_ATTACHMENT, | |
Zend_Mime::ENCODING_BASE64, | |
$filename | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MageMonkey_Mandrill | |
* File: app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php | |
* | |
* Fillout this two functions: | |
* https://github.com/ebizmarts/magemonkey/blob/master/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php#L157 | |
* https://github.com/ebizmarts/magemonkey/blob/master/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php#L165 | |
*/ | |
public function createAttachment($body, | |
$mimeType = Zend_Mime::TYPE_OCTETSTREAM, | |
$disposition = Zend_Mime::DISPOSITION_ATTACHMENT, | |
$encoding = Zend_Mime::ENCODING_BASE64, | |
$filename = null) | |
{ | |
$mp = new Zend_Mime_Part($body); | |
$mp->encoding = $encoding; | |
$mp->type = $mimeType; | |
$mp->disposition = $disposition; | |
$mp->filename = $filename; | |
$this->addAttachment($mp); | |
return $mp; | |
} | |
public function addAttachment(Zend_Mime_Part $att) | |
{ | |
$this->getMail()->addPart($att); | |
$this->getMail()->hasAttachments = true; | |
return $this->getMail(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment