Search code examples
shopwareshopware6

debug shopware6 document pdf


How do we debug the shopware6 pdf generation? A {{ dump() }} will not work, the pdf is not generated. We get an error then:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0')

Are there any possibilities? Maybe can we get the html instead of pdf to find what we are looking for?


Solution

  • See the OrderDocumentCriteriaFactory for which association of the order are available in the template. If you plan on working with an association, be mindful that they must be added to that criteria and may be nullable as well. Adding a sanity check too many is preferable to assuming all orders will come with every association.

    Also see the DocumentTemplateRenderer. If an exception is thrown while rendering the twig template, this is where the exception could be caught for further debugging.