Using Invoice Templates Manager¶
The template list¶
Open Invoice Templates > Templates in the admin area. The list shows Name, Description, Active, Default and Last Updated. You can search and sort by name, and filter by Active.
Each row has these actions:
| Action | What it does |
|---|---|
| Set Default | Flags the template as default and removes the flag from all others. Asks for confirmation. Hidden on the template that is already the default. |
| Preview | Opens the template filled with sample data. |
| Edit | Opens the edit form. |
| Delete | Deletes the template. |
Select several rows to use Delete selected.
Create a template¶
- Click Create Template.
- Enter a Template Name and, if you like, a Description.
- Paste a full HTML document into Template Content (HTML), or choose a file under Upload HTML file (optional).
- Leave Active on if the template should be usable.
- Switch on Default Template if it should become the default right away.
- Save. You return to the list.
Template Content (HTML) is a required field. If you upload a file, you still have to put some text into it. The uploaded file replaces that text when you save.
A minimal template looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
body { font-family: Helvetica, Arial, sans-serif; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; }
.right { text-align: right; }
</style>
</head>
<body>
{{company_logo_html}}
<h1>Invoice #{{invoice_number}}</h1>
<p>Date: {{invoice_date}} | Due: {{due_date}} | Status: {{status}}</p>
<p>{{customer_name}} ({{customer_email}})</p>
<table>
<thead>
<tr>
<th>Description</th>
<th>Qty</th>
<th class="right">Unit price</th>
<th class="right">Total</th>
</tr>
</thead>
<tbody>
{{items_table}}
</tbody>
</table>
<p class="right">Total: {{total}}</p>
</body>
</html>
Edit or replace a template¶
Open a template with Edit, change the fields and save. To replace the whole layout, upload a new file under Upload HTML file (optional) and save. The edit page also has a Delete button.
The built-in templates can be edited and deleted like any other.
Preview a template¶
Preview shows the saved template in a window, filled with fixed sample data: invoice INV-1001, customer John Doe, three sample items and a total of $99.99. Your logo from Paymenter's settings is shown, or the company name if no logo is set.
Note
The preview is rendered by your browser. The real PDF is rendered by Paymenter's PDF library, which supports less CSS. Always check a real invoice PDF before you rely on a new layout. The preview also fills the address and paid date placeholders with sample values that are empty in real PDFs, see below.
Choose the template for all invoices¶
Either click Set Default in the list, or select the template under Default invoice template in the extension's settings. If both are set, the setting wins. The exact order is described in Which template is used.
Placeholder reference¶
Placeholders are replaced by plain text substitution. Write them exactly as shown, with no spaces inside the braces. Templates are not Blade views: PHP and Blade directives are not executed.
Most values have two spellings. Both work and can be mixed.
Invoice¶
| Placeholder | Value |
|---|---|
{{invoice_number}} |
The invoice number, or the invoice ID if the invoice has no number |
{{invoice.id}} |
The invoice ID |
{{invoice_date}} |
Creation date, YYYY-MM-DD |
{{due_date}}, {{invoice.due_date}} |
Due date, YYYY-MM-DD, or N/A if the invoice has none |
{{status}}, {{invoice.status}} |
Invoice status with a capital first letter, for example Paid |
{{currency}} |
The invoice's currency code |
{{invoice.paid_at}} |
Empty in real PDFs |
Amounts¶
| Placeholder | Value |
|---|---|
{{subtotal}}, {{invoice.subtotal}} |
Sum of price x quantity of all items |
{{tax}}, {{invoice.tax}} |
The subtotal multiplied by the invoice's tax rate. Zero if no tax rate applies |
{{total}}, {{invoice.total}} |
The invoice total as Paymenter formats it |
Amounts use the invoice currency's number format, prefix and suffix, with two decimals.
Warning
The subtotal is the sum of the item prices as stored on the invoice, and Paymenter's total is that same sum. The tax figure is calculated on top of the subtotal. When a tax rate applies to the customer, subtotal + tax is therefore higher than the total. Paymenter's own PDF instead shows the subtotal as the total minus the included tax. If you charge tax, check the three figures on a real invoice before you print subtotal and tax on your template.
Customer¶
| Placeholder | Value |
|---|---|
{{customer_name}}, {{client.name}} |
The customer's name |
{{customer_email}}, {{client.email}} |
The customer's e-mail address |
{{customer_address}}, {{customer_city}}, {{customer_zip}}, {{customer_country}} |
Empty in real PDFs |
Warning
The four address placeholders and {{invoice.paid_at}} are filled in the preview but come out empty in real PDFs. The extension reads these values from fields that Paymenter does not have on the customer or the invoice. The built-in templates use the address placeholders, so their Bill To block shows only name and e-mail.
Company¶
| Placeholder | Value |
|---|---|
{{company_name}}, {{company.name}} |
The company name from Paymenter's settings |
{{company_logo_html}}, {{company.logo_html}} |
An <img> tag with your logo embedded in the PDF. If no logo is set, a bold text with the company name |
{{company_logo_url}}, {{company.logo_url}} |
The public URL of the logo, or empty if no logo is set |
Items¶
| Placeholder | Value |
|---|---|
{{items_table}}, {{items}} |
One <tr> per invoice item |
Each row has four cells in this order: description, quantity, unit price, line total. The cells carry inline padding and alignment styles. Put the placeholder inside the <tbody> of a table with four columns.
What the customer sees¶
Customers get no new page, menu entry or option. The only change is the layout of the invoice PDF, in these places:
- the PDF download on the invoice page in the client area,
- the PDF attached to Paymenter's invoice e-mails.
The Download PDF button on an invoice in the admin area produces the same PDF.
Automatic behaviour¶
- PDF generation. Every time Paymenter generates an invoice PDF, the extension renders the selected template. PDFs are generated on request and not stored by the extension, so a template change applies to all invoices from then on, including old ones.
- Built-in templates. Whenever the template table is empty, the extension creates the three built-in templates again on the next request and flags Modern Blue as default.
The extension has no scheduled tasks and sends no e-mails of its own.