The Shopware standard component for PDF document generation 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 Generation. Here you can freely design the order form according to your individual requirements by customizing the order form document template.
The basic settings are explained in this video:
You can find a detailed guide from Shopware on PDF document generation here. You can also find further information from Shopware on how to make changes to templates at this link.
Displaying product prices
The following section provides a guide on how to customize and extend the document template, for example, to display product prices.
Customizing the existing template works the same way as customizing 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 you can add your own fields following the Shopware standard logic for document extension. extra_fields blocks are provided for custom fields per line item on the document. Below in this article, you will find various examples.
Afterwards, in the PDF document generation, all you need to do is replace the name of the Template with the name of the new .tpl file.
Important: The created file must NOT be named "supplier_orders.tpl".Please note that after successfully customizing the document template, the preview function in Shopware's PDF document generation for the supplier order may not work correctly. However, the PDF is still generated correctly in the ordering process.
Note: In the block document_index_table_each_fabricatornumber, either the supplier number (if available) or the Shopware manufacturer number is output.
Displaying the purchase price on the supplier document
To display the purchase price on the supplier document, you can insert the following block into the created .tpl file:
{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}
Displaying the total amount of an order
Within the block
(block name="document_index_table_each")
you can access product information, which in turn allows access to the general order information. To output this information elsewhere in the template, you can use the Smarty function {assign} within the block mentioned above to assign a value to a new variable, for example, as follows:
{assign var="totalValue" value={$position.article->getSupplierOrder()->getTotal()}}Now, using {$totalValue}, you can insert the total amount of the order at any point in the template.
