Jump to content

Is it possible to attach an invoice to more statuses


Recommended Posts

To day one Status is generating an ( One) Invoice. But can I trigger the "Shipped" in my Orderhistory php.file to execute on more statuses ( Order ID's) eg. Order_State=== 11 and how to rewrite the code properbly?

 

This is my current code

if (Validate::isLoadedObject($order))

{
// Join PDF invoice if order status is “shipped”
if ((int)$result['id_order_state'] === 4 && (int)Configuration::get('PS_INVOICE') && $order->invoice_number)
{
$context = Context::getContext();
$pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $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';
}
else
$file_attachement = null;
 
Mail::Send((int)$order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'].' '.$result['lastname'],
null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop);
}
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...