Jump to content
VirtualGarage

Attach an extra PDF to order confirmation e-mail

Recommended Posts

Hello,

i'm trying to add a PDF (our law says we have to send Terms and conditions as attachment to the email) to the order confirmation email, but only found this

https://www.prestashop.com/forums/topic/532204-solved-attach-an-extra-pdf-to-order-confirmation-e-mail/

which does not work in version 1.7.4.3 ... i also looked if there were any modules, but the one that has this capability, says is works up to ver 1.7.2.5 ...

pls did I miss something somewhere or am just blind?

Thank you!

Share this post


Link to post
Share on other sites

Hello,

for Prestashop 1.7.6  - add Terms to order_confirmation email.

classes/Mail.php

before this code: (line cca 570)

if ($fileAttachment && !empty($fileAttachment)) {
                // Multiple attachments?
                if (!is_array(current($fileAttachment))) {
                    $fileAttachment = array($fileAttachment);
                }

 

add this source:

if ($template == 'order_conf'){
	$message->attach(\Swift_Attachment::newInstance(file_get_contents('terms.pdf'), 'terms.pdf', 'application/pdf'));
	$message->attach(\Swift_Attachment::newInstance(file_get_contents('return_money.pdf'), 'return_money.pdf', 'application/pdf'));
}  

files term.pdf and return_money.pdf are in root directory of Prestashop

 

Share this post


Link to post
Share on other sites

Adding PDF with detials about right to return order in 14 days is set by EU law, and we still need edit PHP code to add this to the email? why it's not available edit this via web ui?

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks! Work gr8! 

Do you know how to do it with other order status ?? I have changed order_conf to payment but pdf is blank :( 

I even want to make custom email and sent to file_get_contents parameters of order number like: SG3WC5F, is it possible ? :D

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More