The document creation takes place within the order under the tab Documents. Further information can be found here: Orders
An invoice can be quickly created using Shopware’s standard document functionality in the basic settings. First click “Add entry” and fill out the respective fields. After clicking “Save”, the new document will be automatically assigned a consecutive number from the defined number range.
You can create a notice of delivery following the same method used for creating an invoice. For the notice of delivery, a consecutive number is automatically assigned from the same number range as for the invoice.
By default, notices of cancellation are not assigned a reference number. If you have to create a notice of cancellation, you go into the details of the individual order ("Customers > Orders > Documents") and enter the invoice number in the field Invoice number. The PDF document will then be assigned a cancellation number that refers to the original invoice.
Please keep in mind that partial cancellations in the standard version of Shopware are not supported! If you wish to create partial cancellations, you can do so using the Shopware ERP powered by Pickware plugin. Within this plugin, a notice of cancellation will be assigned a consecutive number from the number range defined in the plugin itself. Further on, the invoice number can also be specified with a reference number.
When creating a credit memo, the document will also be assigned a consecutive number from the number range.
Documents can be deleted in Shopware, but beforehand you should make sure it is ok to delete the document by consulting your law expert. Before the document is deleted, you get a popup, asking you if you really want to delete the document irretrievably. The right to delete documents can be configured by granting or denying the deleteDocument privilege for the order resource in the user administration.
If you are using the Shopware ERP powered by Pickware plugin, you can use the function, Reset settings, to make adjustments to an invoice or cancellation after it has already been created. The original is neither edited nor deleted. Rather, it is created again with a consecutive number referring to the original invoice.
Further information on how to define the number range for your invoices can be found here: Number ranges
With the standard version of Shopware, you can easily create and adapt individual PDF documents to meet your needs. The module can be found under “Configuration > Basic settings > Shop settings > PDF document creation” in your Shopware backend.
The PDF module is divided into 3 separate areas. In the middle column, you will find an overview of all created PDF documents (1). In the upper-right portion of the window, you can define the basic data, settings and template of the document (2). In the lower-right portion of the column, you can access and change all relevant elements of the PDF document (3).
Click Add entry (1) to manually create a new document. Click the pen icon (2) to open the details column, where you can make adjustments to the basic data, template and elements of that particular PDF document.
The "(6) pagination" does only refer to the preview and not to the generation of the document.
In the overview, you will find all elements available within your document structure. Use the dropdown field (1) to select an element.
After selecting an element, you can adjust its content (2). Below the content field, you will find a style field for defining the element’s CSS properties (3).
By clicking the button “Use the config. for all forms” (1), the system applies the changes you’ve made to all other document types. Click the “Save” button to confirm all changes.
Do not drag and drop elements into the editor. Always use the editor function to insert and edit an image.
Here, we describe the basic structure of the PDF documents that you can easier understand how they work and extend each other to let you individualise them easier.
Before you search the template files, check in the shop settings first which "Document template" is set. Depending on this setting, you have to search the document files in that particular template folder. If "Bare" or "Responsive" is set, first, choose your own theme, so you can extend the files from the default ones and remain update safe.
The single files are located in the theme folder:
The invoice (index.tpl) is the main template, this generated the invoice while all the others extend from this file and overwrite their (not) needed elements which are (not) needed. If you want to change e.g. the delivery note, first look in the delivery note template, because changes in the index.tpl will appear in all other documents too, which you may not want.
In the article Making changes in the template we describe how customisation of your template works.
When you want to individualise your templates, this works the same as in other templates, the documents work with Smarty and you can use the known workflow: Templates from the Bare theme are the default, never change these files because at updating Shopware, they might be overwritten! Instead, change your document template in the shop settings to your own theme. If you made no changes, the theme will fall back to the default. After you created the necessary files in your theme's document folder, you can customise them.
Example: You want to change the logo in your invoice: Create in /themes/frontend/YOURTHEME/documents a file named index.tpl and make your changes there. Your theme now uses your customised file, which extends from the default one.
The document templates are not completely covered in smarty blocks, so you can use the extension only for changes you make in smarty blocks.
If you make changes in areas that are not in a smarty block, you need to copy the whole file and make your change there.
Here we list the available data which you can use in the documents. The easiest way to find your needed variable is to print the arrays using {$VARIABLE|print_r} and search for your needed variable.
Variable | Description |
---|---|
{$Containers} | Document settings which you made in the backend |
{$Document} | Data of the document itself |
{$Order} | Data of your order |
{$position} | Data of each position in these order |
{$User} | customer data |
Additional information can be easily added in Shopware using the free text fields. To show those in the documents as well, you just have to do some little changes in your own theme.
First, you have to create a free text field for your product. As an example, we define the field attr5 with the field type "Simple text - VARCHAR(500)" for the table s_articles_attributes. As the label, we use Content for this example. With a click on save, the new free text field is created.
From now on you can fill this field in every product's core data mask which can be filled specifically for every product. In this example, we entered three sorts of tea with the respective content.
Now you want to show the free text field on your documents. In order to do this, please open the template file which creates your document. By default, this is the index.tpl for the invoice and index_ls.tpl for the delivery note. The default document templates can be found in the folder themes/frontend/Bare/documents. If you want to change the documents, you should copy the .tpl file into your own folder and edit it there. Changes in the default folder are not secure for updates. How to create your own theme and basics about theme changes can be found at our Dev Docs. The individual document theme should also be selected at configuration > basic settings > shop settings > shops for your shop.
In the template file you can now edit the block with the name 'document_index_table_name, here you replace the else-area of the if-selection with this:
{else}
{s name="DocumentIndexPositionNameDefault"}{$position.name|nl2br|wordwrap:65:"
\n"}{/s}<br>
{$position.attr5}
{/if}
This creates a line break behind the product name and displays the free text field value, what looks like this:
Maybe you do not want to display a product-related free text field, but a global order free text field. This can be created, just like explained before, for the table s_order_attributes.
You could add the following variable to a fitting block. Here is an example of a free text field with the name attribute6:
{$Order._order.attributes.attribute6}