Jump to content

How to send delivery slip as mail attachment to customer once the order status changed to "Shipped"


Recommended Posts

Hi,

Is it possible to add functionality like for example

when order status change to "Shipped" a mail forward to the customer with the attachment of delivery slip. 

if so please help me how can i add this functionality to my shop.

 

thanks in advance.

any one!

Link to comment
Share on other sites

any one!

At last i found the solution.

 

first to copy OrderHistory.php file in /override/classes/order then add following codes in function addWithemail at line 419.

// Join PDF delivery slip if order status is "delivered"
                elseif((int)$result['id_order_state'] === 4 && (int)Configuration::get('PS_INVOICE') && $order->invoice_number)
                {
                    $context = Context::getContext();
					$pdf = new PDF($order->getDeliverySlipsCollection(), PDF::TEMPLATE_DELIVERY_SLIP, $context->smarty);
					$file_attachement['content'] = $pdf->render(false);
					$file_attachement['name'] = Configuration::get('PS_DELIVERY_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->delivery_number).'.pdf';
					$file_attachement['mime'] = 'application/pdf';
                    
                }
				else
					$file_attachement = null;

and then in Order>Statuses enable "Send email to customer" for the status Shipped.

thanks and enjoy.

Edited by ArsalanAnsari (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...