Jump to content

How to add a invoice pdf from my billing software to orders?


Tomi14

Recommended Posts

59 minutes ago, Tomi14 said:

I would like to attach pdfs with invoices from my invoicing program, but I cannot find anywhere in the order panel a field for adding any attachments

You will need a dedicated module for this.

Normally Presta only sends invoices generated by itself.

Link to comment
Share on other sites

There are 2 options i.e 

Option 1: Attaching the Invoice to the Order Confirmation Email

->To attach the invoice to the order confirmation email in PrestaShop, you can follow these steps:

->Locate the file paymentModule.php, which is usually found in the modules/{your_payment_module}/ directory.

->Look for the validateOrder() function within paymentModule.php.

->Inside the validateOrder() function, locate the section where the order confirmation email is sent. It usually contains a line similar to the following:

Quote

Mail::Send(
                                (int) $order->id_lang,
                                'order_conf',
                                $this->context->getTranslator()->trans(
                                    'Order confirmation',
                                    [],
                                    'Emails.Subject',
                                    $orderLanguage->locale
                                ),
                                $data,
                                $this->context->customer->email,
                                $this->context->customer->firstname . ' ' . $this->context->customer->lastname,
                                null,
                                null,
                                $file_attachement,
                                null,
                                _PS_MAIL_DIR_,
                                false,
                                (int) $order->id_shop
);

->You can attach multiple files in the same mail using "file_attachement" variable.

 

Option 2: Updating the Invoice Data using the "actionPDFInvoiceRender" Hook

->To update the invoice data and add additional content you can use the "actionPDFInvoiceRender" hook, andusing that hook, you can append your content after the invoice content.

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...