viki Posted April 25, 2022 Share Posted April 25, 2022 I have try to modify module ps_emailalerts for site admin get pdf invoice also. Add to function hookActionValidateOrder in ps_emailalerts before Mail::Send this code: /* attach pdf patch */ $order_invoice_list = $order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', ['order_invoice_list' => $order_invoice_list]); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty); $attach=array(); $content = $pdf->render(false); $attach['content'] = $content; $attach['name'] = Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->id) . '.pdf'; $attach['mime'] = 'application/pdf'; And modified call of Mail::Send function for attachment support: Mail::send( $mail_id_lang, 'new_order', $this->trans( 'New order : #%d', [ $order->id, ], 'Emails.Subject', $locale), $template_vars, $merchant_mail, null, $configuration['PS_SHOP_EMAIL'], $configuration['PS_SHOP_NAME'], $attach, null, $dir_mail, false, $id_shop ); But call of $pdf->render(false) return NULL... what could be the problem? I have use Prestashop 1.7.8.5 Link to comment Share on other sites More sharing options...
knacky Posted April 28, 2022 Share Posted April 28, 2022 (edited) $attach = array(); if (intval(Configuration::get('PS_INVOICE')) AND $order->invoice_number) { $attach['content'] = PDF::invoice($order, 'S'); $attach['name'] = Configuration::get('PS_INVOICE_PREFIX', intval($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf'; $attach['mime'] = 'application/pdf'; } else { $attach = NULL; } Mail::send(...... Edited April 28, 2022 by knacky (see edit history) 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