The Shopware standard component for PDF document creation is used to create the supplier order form for reordering from suppliers. You can find the corresponding configuration under Settings → Basic Settings → Shop Settings → PDF Document Creation. Here you can freely design the order form according to your individual requirements by customising the order form document template.
The basic settings are explained here in the video:
Click on the respective link to view Shopware's instructions on how to create PDF documents and how to modify templates.
Display item prices
In the following section you will find instructions on how to customise and extend the document template, e.g. to display item prices.
The adaptation of the existing template works in the same way as the adaptation of the other documents, such as the invoice:
- Create a .tpl file in the folder themes/Frontend/Bare/documents with the following content:
{namespace name=backend/viison_pickware_erp_supplier_orders/document}
{extends file="documents/supplier_order.tpl"} - Now, according to the Shopware standard logic for document extension, own fields can be added. For custom fields, extra_fields blocks are provided per position on the document.
- Afterwards, the name of the template must be replaced by the name of the new .tpl file in the PDF document creation. Further down in this article you will find a few examples.
Important: The file created must NOT be named supplier_orders.tpl. - Please note that after successfully modifying the document template, the Preview function may not work correctly. The PDF will nevertheless be created correctly in the ordering system.
Show purchase price on supplier document
To display the purchase price on the supplier document, the following block can be inserted into the .tpl file created:
{block name="document_index_head_extra_fields" append}
<td align="right" width="10%" class="head"><strong>{s name=purchasePrice}{/s}</strong></td>
{/block}
{block name="document_index_table_each_extra_fields" append}
<td align="right">
{if $currency.symbolOnLeft}
{$currency.symbol}
{/if}
{$position.article->getPrice()}
{if !$currency.symbolOnLeft}
{$currency.symbol}
{/if}
</td>
{/block}
Show total amount of an order
Inside the block
(block name="document_index_table_each")
item information can be accessed, which in turn allows access to the general order information. To output this information elsewhere in the template, the smarty function {assign} within the above block can be used to assign a value to a new variable, for example as follows:
{assign var="totalValue" value={$position.article->getSupplierOrder()->getTotal()}}
Now you can use {$totalValue} to insert the total amount of the order anywhere in the template.