Merge branch '1.10' into 1.11

* 1.10:
  [DOCS] customizing logo in Credit Memo's
  [Docs] How to customize the invoice logo - updated cookbook
This commit is contained in:
Grzegorz Sadowski 2022-01-17 14:50:36 +01:00
commit f026b78079
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
4 changed files with 50 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View file

@ -23,10 +23,35 @@ Before you start make sure that you have:
#. `Sylius/InvoicingPlugin <https://github.com/Sylius/InvoicingPlugin/>`_ installed.
#. `Wkhtmltopdf <https://wkhtmltopdf.org/>`_ package installed, because most of pdf generation is done with it.
How to change the logo in the Invoice?
----------------------------------------
In order to change the logo on the invoice, set up the ``SYLIUS_INVOICING_LOGO_FILE`` environment variable.
Example custom configuration:
.. code-block:: text
SYLIUS_INVOICING_LOGO_FILE=%kernel.project_dir%/assets/custom-logo.png
Make sure to clear the cache each time the configuration is changed.
If you have a permission issue when generating an invoice, you may also need to update the ``config/packages/knp_snappy.yaml`` configuration file:
.. code-block:: yaml
knp_snappy:
pdf:
options:
allow: '%env(resolve:SYLIUS_INVOICING_LOGO_FILE)%'
.. image:: ../../_images/cookbook/custom-invoice/pdf_with_custom_logo.png
How to customize the invoice appearance?
----------------------------------------
There might be need to change how the invoices look like, f.e. shop is using its own logo, there might be some colours changed
There might be need to change how the invoices look like, f.e. there might be different logo dimension, some colours changed
on the tables, or maybe the order of fields might be changed.
First let's prepare the HTML's so we can modify them. This command will copy only the PDF template:

View file

@ -21,6 +21,30 @@ The first exemplary customization is to change background color of the heading o
/* ... */
</style>
How to change the logo in the Credit Memo?
------------------------------------------
Credit Memo's logo is by default displayed as Sylius logo.
Changing it is done by modifying the ``SYLIUS_REFUND_LOGO_FILE`` environment variable.
You can achieve that by updating it's path in your ``.env`` file like in example below:
.. code-block:: text
SYLIUS_REFUND_LOGO_FILE=%kernel.project_dir%/assets/custom-logo.png
If you have a permission issue when generating a credit memo, you may also need to update ``config/packages/knp_snappy.yaml`` file with an ``allow`` parameter:
.. code-block:: yaml
knp_snappy:
pdf:
options:
allow: '%env(resolve:SYLIUS_REFUND_LOGO_FILE)%'
Make sure to clear the cache each time the configuration is changed.
.. image:: ../../_images/cookbook/custom-credit-memo/customized-pdf.png
Displaying additional Customer's data on Credit Memo
----------------------------------------------------