Services¶
The extension brings with the Services.yaml a registration of an EventListener on
Extcode\Cart\Event\ProcessOrderCreateEvent
.
As in the documentation for
PDF generation,
the TypoScript configuration plugin.tx_cart.autoGenerateDocuments
can be used to
define which documents should be generated.
This can also be overridden by the optional parameter $options
with the EventListener
registration.
Extcode\CartPdf\EventListener\ProcessOrderCreate\DocumentRenderer:
arguments:
$orderItemRepository: '@Extcode\Cart\Domain\Repository\Order\ItemRepository'
$persistenceManager: '@TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager'
$options:
autoGenerateDocuments:
order: true
tags:
- name: event.listener
identifier: 'cart-pdf--process-order-create--document-renderer'
event: Extcode\Cart\Event\ProcessOrderCreateEvent
after: 'cart--process-order-create--order-number'
before: 'cart--process-order-create--email'
This makes it possible to generate different documents for different order processes. For example, only the order confirmation (orderPdf) for prepayment but the invoice (invoicePdf) for all completed payments with a payment provider extension like PayOne.
Currently there is only the option autoGenerateDocuments
provides and array of the documents to be
generated is expected. Analogous to the TypoScript configuration, order is set to true here to generate
the order confirmation (orderPdf).