motabik Posted October 11, 2016 Share Posted October 11, 2016 Hi I search in google information, how I can add attachments to the mail order_conf.and I can't find.And I solve problem.I write how it can do.You must copy classes PaymentModule.php from folder classes to override/classesand edit this file.About line 761 You find function who add invoice // Join PDF invoiceYou must edit this line and add your attachment.I add file for attachment in catalogue docsI disable send invoice and change code for this. // Join PDF invoice if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number) { $order_invoice_list = $order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty); $file_attachement['content'] = $pdf->render(false); $file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf'; $file_attachement['mime'] = 'application/pdf'; } else { // $file_attachement = null; $file_attachement['content'] = file_get_contents(_PS_ROOT_DIR_.'/docs/file1.pdf'); $file_attachement['name'] = File1.pdf'; $file_attachement['mime'] = 'application/pdf'; $file_attachement1['content'] = file_get_contents(_PS_ROOT_DIR_.'/docs/file2.pdf'); $file_attachement1['name'] = 'file2.pdf'; $file_attachement1['mime'] = 'application/pdf'; $attach =array($file_attachement, $file_attachement1); } if (self::DEBUG_MODE) { PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int)$id_cart, true); } if (Validate::isEmail($this->context->customer->email)) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $this->context->customer->email, $this->context->customer->firstname.' '.$this->context->customer->lastname, null, null, $attach, null, _PS_MAIL_DIR_, false, (int)$order->id_shop ); Link to comment Share on other sites More sharing options...
Prestaweb.org Posted March 7, 2019 Share Posted March 7, 2019 Code look right, check please that file _PS_ROOT_DIR_.'/docs/file1.pdf' really exist, than try to send only 1 file Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now