MageMonkey has been deprecated on March 4th, 2017. Please switch to MailChimp for Magento


This topic can no longer be replied to because it has been locked.

Mandrill conflicting with other module
Gravatar
Joined: 2013-04-10
Posts: 8
I have installed Magemonkey 1.1.5 in my Magento CE 1.5.0.1 and tried to activate Mandrill for all transaction emails.

While playing around I found out that another module overwrites <email_template>. After deleting this part from the other extensions config Mandrill integration works for most parts. Only thing not working is "transactional mails for invoice". This part fails due to the removed part from the config file.

However: I need this extension as it allows attaching PDF invoices to the emails, plus it allows for easy PDF layouting.

The conflicting extension is: Vianetz_AdvancedInvoiceLayout 1.1.32. Is there any option to get the two working nicely together? Any help is appreciated.
Gravatar
Joined: 2012-03-09
Posts: 1636
Hi Sebastian,

Try editing the file: app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php
changing the definition class like this:

class Ebizmarts_Mandrill_Model_Email_Template extends Mage_Core_Model_Email_Template

to

class Ebizmarts_Mandrill_Model_Email_Template extends Vianetz_AdvancedInvoiceLayout_Model_Email_Template

Check in the vianetz folder you should find the class in a path like this one -> app/code/community/Vianetz/AdvancedInvoiceLayout/Model/Email/Template.php.

This line I'm not sure if it's exactly the the same, check in her Template file: Vianetz_AdvancedInvoiceLayout_Model_Email_Template

Here what are you doing it's saying to our extension that use the Vianetz one.

Be sure to add the <rewrite><email_template>Vianetz_AdvancedInvoiceLayout_Model_Email_Template</email_template></rewrite> again if not it wont work

After this changes remove your Magento cache and try to send some test emails.

Please let me know if this works

Kindest Regards
Gravatar
Joined: 2013-04-10
Posts: 8
Dear Luis,

thank you! At least this has got me one step further: After again removing the "overwrites email" clause from the Vianetz config.xml and following your description I can now send invoice emails via Mandrill.

However now the attached PDF file is somehow corrupted. Thunderbird shows two attachments "part 1.2" and "part 1.3". I can save both of them as somename.pdf and open them in PDF viewer: everything seems ok, exccept our logo is corrupted? A webmailer shows a file named "application-octet-stream-attachment" which I can too open in PDF Viewer.

I'll paste the mandrill API log in a separate post. Any idea how to fix the attachment?
Gravatar
Joined: 2013-04-10
Posts: 8
API Log
Method: messages/send.json
Time: Apr 11, 2013 12:22 am
Call time: 40.9ms
IP: xx.xx.xx.xx
User Agent: Ebizmarts_Mandrill1.0.5/MageCE1.5.0.1

Full Request
{ "message": { "html": "<html>\r\n<style type=\"text/css\">\r\n body,td [more html code] <tr>\r\n <td>\r\n <a >AGB / Widerrufsbelehrung</a> \r\n\t </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n</html>", "subject": "Onlineshop: Rechnung zu Deiner Bestellung", "from_name": "Onlineshop", "from_email": "xxx@xxxxxxx.xx", "bcc_address": "", "tags": [ "Neue Rechnung (Template)" ], "attachments": [ { "type": "application/octet-stream", "content": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMC [more bin code...] KNjU2MjIKJSVFT0YK" } ], "to": [ { "email": "xxx@xxxxxxx.xx", "name": "info" } ] }, "key": "************" }

Full Response
[ { "email": "xxx@xxxxxxx.xx", "status": "queued", "_id": "3e22a38d2a0942a7874ca91c9f6e4f2c" } ]
Gravatar
Joined: 2012-03-09
Posts: 1636
Hi Sebastian,

I need to see this more in deep, i don't have this extension you use but it will try to see how to fix this.

Kindest Regards
Gravatar
Joined: 2013-04-10
Posts: 8
I can provide you with the extensions files for testing purposes, if needed. Just tell me where I should send/upload the zip file...
Gravatar
Joined: 2012-03-09
Posts: 1636
Hi Sebastian,

Ok, send it to me to luisd@ebizmarts.com.

Kindest Regards

Gravatar
Joined: 2013-04-10
Posts: 8
For all others:

Luis provided me with a new function that simply had to be added in the file

app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php

Copy and paste this function like it's:

public function addAttachment($file, $filename){ $attachment = $this->getMail()->createAttachment($file, 'application/pdf', null, null,$filename); }

Worked like a charm!

Except: now every invoice email I receive as a copy to my mail account has the invoice PDF attached twice? However the customer receives only one PDF invoice with his mail. Strange, but I can live with that. grin
Gravatar
Joined: 2012-03-09
Posts: 1636
Hi Sebastian,

Thanks for share this information with everybody.
About the double invoice in the copy email can be solved changing the property -> System -> Configuration -> Sales Emails -> Send Invoice Email Copy Method TO Bcc.
This send just one email instead of a separate email.

Kindest Regards
Gravatar
Joined: 2013-04-10
Posts: 8
Dear Luis,

setting the the email method to BCC solved the double PDF... Thank you for your great support! grin

NEWSLETTER

Subscribe to our newsletter to receive emails and useful news articles