The FOSSBilling Forum
Email template - invoice.lines - How to show purchased items of invoice? - Printable Version

+- The FOSSBilling Forum (https://forum.fossbilling.org)
+-- Forum: Support (https://forum.fossbilling.org/forum-7.html)
+--- Forum: Support - Setup & Configuration (https://forum.fossbilling.org/forum-9.html)
+--- Thread: Email template - invoice.lines - How to show purchased items of invoice? (/thread-33.html)



Email template - invoice.lines - How to show purchased items of invoice? - diogo-plta - 10-30-2024

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.


RE: Email template - invoice.lines - How to show purchased items of invoice? - BelleNottelling - 10-31-2024

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.


RE: Email template - invoice.lines - How to show purchased items of invoice? - diogo-plta - 10-31-2024

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.


RE: Email template - invoice.lines - How to show purchased items of invoice? - BelleNottelling - 11-03-2024

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