Fix: PDF Invoice Generation Fails After Shopware Update (5.7.18)

After updating to Shopware 5.7.18, some users encountered a fatal error preventing PDF invoice generation. The error message, as reported in the Shopware forum, indicated a problem with Smarty template security settings:

Fatal error: Uncaught SmartyException: directory '/home/chrvwgsg/www.bf-sportwagen.de/themes/Frontend/BFSportwagen/documents/index.tpl' not allowed by security setting in /home/chrvwgsg/www.bf-sportwagen.de/engine/Library/Smarty/sysplugins/smarty_security.php:379

The user, 'zwan,' initially tried disabling plugins and switching themes without success, suggesting the issue was internal to Shopware.

Another user, 'Max_Shop,' pointed out that the error description indicated the template directory was being flagged as insecure, possibly due to manual overrides. They suggested checking the smarty_security.php file for potential misconfigurations.

Ultimately, 'zwan' found a solution by copying the PDF template files (the "documents" folder) to the root directory and then adjusting the paths in Grundeinstellungen → PDF Erstellung (Basic settings -> PDF creation) to point directly to "index.tpl" in the root, effectively removing the folder from the path. This workaround resolved the issue.

Solution Summary (English Translation):

  1. The problem: After updating to Shopware 5.7.18, PDF invoice generation fails with a Smarty security error.
  2. The cause: Shopware flags the template directory as insecure.
  3. The fix: Copy the PDF template files from the "documents" folder in your theme to the root directory of your Shopware installation.
  4. Update the PDF creation settings in the Shopware backend (Grundeinstellungen → PDF Erstellung) to point to the index.tpl file in the root directory.

This solution provides a practical workaround for users experiencing PDF invoice generation issues after updating to Shopware 5.7.18.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools