Jump to content

PDF invoice send by email


Recommended Posts

Hello,

I'm looking for a solution that it's possible to send the pdf invoice by email in the backoffice.
The nicest way will be when I change the order state to (for example) send invoice an automatic email will be sent with attached the pdf invoice.

Does anyone know a solution?

Thanks!

Link to comment
Share on other sites

  • 2 months later...

Try to modify clacc paymentmodule.php and comment the lines:350,351,355,356,357.
Or simply change this code:

                   if (intval(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
                   {
                       $fileAttachment['content'] = PDF::invoice($order, 'S');
                       $fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', intval($order->id_lang)).sprintf('d', $order->invoice_number).'.pdf';
                       $fileAttachment['mime'] = 'application/pdf';
                   }
                   else
                       $fileAttachment = NULL;



By this one

                   //if (intval(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)
                   //{
                       $fileAttachment['content'] = PDF::invoice($order, 'S');
                       $fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', intval($order->id_lang)).sprintf('d', $order->invoice_number).'.pdf';
                       $fileAttachment['mime'] = 'application/pdf';
                   //}
                   //else
                   //    $fileAttachment = NULL;

Link to comment
Share on other sites

  • 4 months later...

this works, but how can I change the PDF filename who send by the e-mail ?
I use this code above for sending the PDF into the order confirmation mail.

My filename in the mail what I get right now: NLd.pdf
I like to get the order number instead.

Link to comment
Share on other sites

I think the code posted above there is an mistake, Please change following 'd' to '%d'

sprintf('%d', $order->invoice_number)

After change, you file name will become something like NL12345.pdf, where NL is the prefix you define at your office(Orders - Invoices), and 12345 is the invoice no.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 2 months later...
  • 1 year later...
  • 1 year later...
×
×
  • Create New...