The FOSSBilling Forum Support Support - Setup & Configuration Email template - invoice.lines - How to show purchased items of invoice?

Email template - invoice.lines - How to show purchased items of invoice?

Email template - invoice.lines - How to show purchased items of invoice?

 
  • 1 Vote(s) - 5 Average
 
diogo-plta
Junior Member

3
10-30-2024, 05:44 PM #1
The invoice template only show the invoice value and due date, but how to show purchased items of invoice?

Possible variables are blank like {{ invoice.lines.lines }} or {{ invoice.lines.text1 }}

I saw that invoice.lines is the variable to show items at invoice page, but what we can do to show it in emails templates? Maybe is it a bug?

I'm trying to find the file where is setted this email template variables, if you know, please.
diogo-plta
10-30-2024, 05:44 PM #1

The invoice template only show the invoice value and due date, but how to show purchased items of invoice?

Possible variables are blank like {{ invoice.lines.lines }} or {{ invoice.lines.text1 }}

I saw that invoice.lines is the variable to show items at invoice page, but what we can do to show it in emails templates? Maybe is it a bug?

I'm trying to find the file where is setted this email template variables, if you know, please.

BelleNottelling
Administrator

65
10-31-2024, 11:04 AM #2
invoice.lines is an array, so invoice.lines.lines is trying to reference an array key that does not exist.

You want something like so to iterate over each line item:

Code:

<ul>
  {% for line in invoice.lines %}
    <li>{{ line.title }} {{ line.price }}</li>
  {% endfor %}
</ul>

There is also line.period, line.quantity, line.unit, line.price, line.tax, line.taxed, line.charged, and line.total.
BelleNottelling
10-31-2024, 11:04 AM #2

invoice.lines is an array, so invoice.lines.lines is trying to reference an array key that does not exist.

You want something like so to iterate over each line item:

Code:

<ul>
  {% for line in invoice.lines %}
    <li>{{ line.title }} {{ line.price }}</li>
  {% endfor %}
</ul>

There is also line.period, line.quantity, line.unit, line.price, line.tax, line.taxed, line.charged, and line.total.

diogo-plta
Junior Member

3
10-31-2024, 12:09 PM #3
It's right, thank you.

Another useful variable that I can't find is the category or type of the service/product to describe in the invoice.

For example:
{{ line.category }} {{ line.title }} -  {{ line.price}}

Maybe it's not configured. Do you know where these variables used in the email template are configured?

I am testing and preparing fossbilling to work in production, only for invoices and payments, everything indicates that it will be possible.

I appreciate your attention and I hope to follow and help the project.
Edited 10-31-2024, 12:24 PM by diogo-plta.
diogo-plta
10-31-2024, 12:09 PM #3

It's right, thank you.

Another useful variable that I can't find is the category or type of the service/product to describe in the invoice.

For example:
{{ line.category }} {{ line.title }} -  {{ line.price}}

Maybe it's not configured. Do you know where these variables used in the email template are configured?

I am testing and preparing fossbilling to work in production, only for invoices and payments, everything indicates that it will be possible.

I appreciate your attention and I hope to follow and help the project.

BelleNottelling
Administrator

65
11-03-2024, 02:55 PM #4
Getting the product category would not be straightforward I'm afraid..
You'd have to first get the order item off of the invoice line item (the rel_id variable).
Then, use the API to get the info for that order which will include product_id as a variable, which would then give you the product_category_id which would then need to be used in yet another lookup
BelleNottelling
11-03-2024, 02:55 PM #4

Getting the product category would not be straightforward I'm afraid..
You'd have to first get the order item off of the invoice line item (the rel_id variable).
Then, use the API to get the info for that order which will include product_id as a variable, which would then give you the product_category_id which would then need to be used in yet another lookup

 
  • 1 Vote(s) - 5 Average
Recently Browsing
 2 Guest(s)
Recently Browsing
 2 Guest(s)