EXT: Cart Pdf 

Classification

cart

Version

main

Language

en

Description

Cart is a small but powerful extension which "solely" adds a shopping cart to your TYPO3 installation. CartPdf allows you to generate attractive PDFs. Whether order confirmations, invoices, delivery notes, or even your own types. The EventListener integrates itself into the ordering process so that the generated files are sent as email attachments.

Keywords

cart, shop, pdf, order, invoice

Autor

Daniel Gohlke

E-Mail

ext@extco.de

License

This document is published under the Open Publication License available from http://www.opencontent.org/openpub/

Rendered

Fri, 05 Dec 2025 14:09:51 +0000

The content of this document is related to TYPO3, a GNU/GPL CMS/Framework available from www.typo3.org.

Table of Contents

Introduction 

EXT:cart_products needs to be used together with EXT:cart.

EXT:cart itself is only the base for a webshop.

Only using EXT:cart does not allow to sell anything because there are no products.

Therefore EXT:cart needs other extensions. One of those other extensions is EXT:cart_products.

Sponsoring 

If there is a feature that has not yet been implemented in Cart or Cart Pdf, you can contact me at any time.

There is also the possibility to support the further development independently of new functions.

Installation 

Depending on your needs you have two options to install the extension.

Installation using composer 

The recommended way to install the extension is by using Composer. In your composer based TYPO3 project root, just do

composer require extcode/cart-pdf.

Installation from TYPO3 Extension Repository (TER) 

An installation from TER is not possible because tecnickcom/tcpdf will be installed as a dependency. Installing external packages is not provided by the extension manager.

Latest version from git 

You can get the latest version from git by using the git command:

git clone git@github.com:extcode/cart_pdf.git
Copied!

Preparation: Include static TypoScript 

The extension ships some TypoScript code which needs to be included.

  1. Switch to the root page of your site.
  2. Switch to the Template module and select Info/Modify.
  3. Press the link Edit the whole template record and switch to the tab Includes.
  4. Select Shopping Cart - Cart Pdf at the field Include static (from extensions):
  5. Select one or more of Shopping Cart - Cart Pdf - Order PDF, Shopping Cart - Cart Pdf - Invoice PDF, Shopping Cart - Cart Pdf - Delivery PDF at the field Include static (from extensions):

Main Configuration 

Preparation: Include static TypoScript 

The extension comes with several TypoScript configuration files. One for general configuration an one for each type of PDF.

Preparation: Folder for PDF files 

Furthermore, the folders must be created in which the PDF files are to be stored. The standard TypoScript configuration sees folder tx_cart/order_pdf, tx_cart/invoice_pdf and tx_cart/delivery_pdf in the fileadmin directory. If another folder should be used, the values are available for each PDF data type storageRepository and storageFolder ready.

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'
Copied!

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).

Breaking: #35 - Extract writing document to FileWriterService 

See Issue 135

Description 

To enable the PDF content to be written using a separate file name, writing the rendered content should be moved to a separate service.

Your own service can then be integrated via dependency injection.

Affected Installations 

All installations which overwrite \Extcode\CartPdf\Service\PdfService::createPdf and \Extcode\CartPdf\Service\PdfService::renderPdf are affected. These methods were removed. The functionality was moved to \Extcode\CartPdf\Service\PdfService::renderDocument and return the pdf content as string. Saving the file was handed over to the new \Extcode\CartPdf\Service\FileWriterService::writeContentToFile.

Migration 

Move the logic to an own implementation of the \Extcode\CartPdf\Service\FileWriterServiceInterface and inject this own service to the \Extcode\CartPdf\EventListener\Order\Finish\DocumentRenderer.

7.0 Changes 

This is the initial release of cart_pdf for TYPO3 v12.4 and cart v10.5 and above.

5.0 Changes 

This is the initial release of cart_pdf for TYPO3 v10.4 and cart v7.0.0 and above.

4.0 Changes 

This is the initial release of cart_pdf for TYPO3 v9.5 and cart v6.3.0 and above.

3.0 Changes 

The version 3.0.0 is a release for TYPO3 v8.7 only and skipped for TYPO3 v9.5.