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