Jump to content

Replace invoice.pdf by delivery-slip.pdf attachment sending email_conf


Recommended Posts

Hi,


 


The email_conf sent to the client includes invoice.pdf as an attacment.


 


I have to replace this atachment by the delivery-slip.pdf.


 


I think I have to modify classes/PaymentModule.php but not too sure about what to put. I think my modifications in blue are correct andif so, I don't know how to modify the code in red.


 


Well, actually stuck here, if any idea or advice... many thanks in advance.


 


Original Code 


 // Join PDF invoice

if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)

{

$pdf = new PDF($order->getInvoicesCollection(), 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';

 

Code midified


// Join PDF invoice

                        if ((int)Configuration::get('PS_DELIVERY_SLIP') && $order_status->delivery_slip && $order->delivery_slip_number)

                        {

                            $pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_DELIVERY_SLIP, $this->context->smarty);

                            $file_attachement['content'] = $pdf->render(false);

                            $file_attachement['name'] = Configuration::get('PS_DELIVERY_SLIP_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->delivery_slip_number).'.pdf';

                            $file_attachement['mime'] = 'application/pdf';

                        }


 


 


Link to comment
Share on other sites

cooool I found it!

 

The right code to modify is as below (just replace the code by this one below). I was wrong with the variable in bold

 

 // Join PDF invoice
                        if ((int)Configuration::get('PS_INVOICE') && $order_status->invoice && $order->invoice_number)
                        {
                            $pdf = new PDF($order->getDeliverySlipsCollection(), PDF::TEMPLATE_DELIVERY_SLIP, $this->context->smarty);
                            $file_attachement['content'] = $pdf->render(false);
                            $file_attachement['name'] = Configuration::get('PS_DELIVERY_SLIP_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->delivery_slip_number).'.pdf';
                            $file_attachement['mime'] = 'application/pdf';
                        }
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...