Page 1 of 1

[SOLVED] Add order status to the invoice layout

Posted: Tue Nov 19, 2024 11:04 pm
by sascha2012
How can I add order status to the invoice layout?

Re: Add order status to the invoice layout

Posted: Tue Nov 19, 2024 11:59 pm
by softmonke
sascha2012 wrote:
Tue Nov 19, 2024 11:04 pm
How can I add order status to the invoice layout?
Go to "admin/controller/sale/order.php" and look for the "invoice" function. In that function, you should see the following line of code:

Code: Select all

$data['orders'][] = array(
Just add the order status into the array, like:

Code: Select all

'order_status' => $order_info['order_status']
and just display the order status in the template file (admin/view/template/sale/order_invoice.twig), like:

Code: Select all

{{order.order_status}}

Re: Add order status to the invoice layout

Posted: Sun Nov 24, 2024 2:55 pm
by sascha2012
Unfortunately that doesn't work

Re: Add order status to the invoice layout

Posted: Sun Nov 24, 2024 10:50 pm
by OSWorX
sascha2012 wrote:
Sun Nov 24, 2024 2:55 pm
Unfortunately that doesn't work
What is not working?
Did you added the code as advised?

If all is done correct, the status will be displayed (IF there is s status already and NOT 0)

Re: Add order status to the invoice layout

Posted: Mon Nov 25, 2024 8:21 pm
by paulfeakins
sascha2012 wrote:
Sun Nov 24, 2024 2:55 pm
Unfortunately that doesn't work
Please read this: https://www.antropy.co.uk/blog/how-to-r ... right-way/

Re: Add order status to the invoice layout

Posted: Wed Nov 27, 2024 1:49 pm
by sascha2012
OSWorX wrote:
Sun Nov 24, 2024 10:50 pm
sascha2012 wrote:
Sun Nov 24, 2024 2:55 pm
Unfortunately that doesn't work
What is not working?
Did you added the code as advised?

If all is done correct, the status will be displayed (IF there is s status already and NOT 0)
Of course I added code and order status is Complete.
And I tried that, {% if order.order_status %}{{ order.order_status }}{% endif %}
but that doesn't work either. Order status is not displayed on the invoice print

Re: Add order status to the invoice layout

Posted: Wed Nov 27, 2024 2:06 pm
by sascha2012
Ok my mistake. Now it works. OSWorX thanks