As already mentioned you should customize the template files. They are very basic and may not include
any new features that were introduced in the latest releases.
For the customization you just need some little knowledge of HTML and CSS. PHP knowledge is not needed by default but may help if you want to achieve special layouts or functions.
First of all please remember that there is a basic styling for each template. The files use two CSS stylesheets
and some hardcoded styles. If you want to customize your template you should make changes in the hardcoded part
which means: edit the content between
</style> only. Do not
edit the templates.css as changes will be overwritten on updates.
Before you start to add any new fields or create conditional statements you should get an overview of which
variables are availalbe for the quote or invoice. Therefore go to the bottom of the template and add the
following code directly above the
</body> tag. Replace invoice with quote
if you edit a quote template.
<pre><?php print_r($invoice); ?></pre>
If you load the template now you will see something like this but with hundred more lines:
stdClass Object ( [invoice_custom_id] => 13 [invoice_id] => 24 [invoice_custom_archive_id] => [client_custom_id] => 8 ...
This is the list of all available variables where the part in the brackets (e.g.
invoice_id) is the
name of the variable and the part after the
=> is the content of the variable.
Here is a list of some examples for code that can be used to display variables.
quote when editing quote templates.
variable_name with the actual name of the variable.
Add a new Variable
To add a new variable to the template. Replace
<?php echo $invoice->variable_name; ?>
If you want to display amounts you have to use this code in order to display the amount in the correct format.
<?php echo format_currency($invoice->variable_name); ?>
Only display code if a variable is not empty. This could be used for example if you don't want to display the taxes column if there are no taxes.
<?php if(!empty($invoice->variable_name)): ?> -- display any HTML or variables here -- <?php endif; ?>
Display the Invoice Logo
The logo can be set in the System Settings.
<?php echo invoice_logo_pdf(); ?>