Overwriting the email templates?

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Webrocker
Posts: 6
Joined: 05 Dec 2023, 17:36

Overwriting the email templates?

Post by Webrocker » 05 Dec 2023, 18:30

Hi,

I'm using TYPO3 v11.5.27 and aimeos v22.10.9, PHP 8.1 on Ubuntu

I'm a bit confused how and where the templates for the emails that get send via the cronjob can be overwritten.
I have spent quite some time now in the aimeos docs, but I think I'm too thickheaded to understand how this is supposed to work :-)

I see that in

Code: Select all

typo3conf/ext/aimeos/Resources/Private/Libraries/aimeos/ai-controller-jobs/templates/order/email
there are the templates that I need to modify.

I have a extension in

Code: Select all

typo3conf/ext/my_shop/
where, aside from the TYPO3 stuff, there is a

Code: Select all

typo3conf/ext/my_shop/Resources/Private/Extensions/aimeos/
directory which contains the stuff that a "aimeos" extension (not the aimeos TYPO3 extension) has. Config, Setup, etc and a Template directory.

In that Template directory I can add modifications, for example for the price partial:

Code: Select all

typo3conf/ext/my_shop/templates/client/html/common/partials/price.php
This works, and I see the changes in the front end.

Now if I try to overwrite the above mentioned controller-jobs templates

Code: Select all

typo3conf/ext/my_shop/templates/controller/jobs/order/email/html.php
This doesn't work. If I set this template file via the TypoScript settings directly at the cronjob setup, it only works if I give the absolute path there -- like

Code: Select all

controller.jobs.order.email.payment.template-html = /var/www/htdocs/typo3conf/ext/my_shop/....../html.php
I think this is a problem then if this template uses partials?
What if I need to modify the partial for the email-oder-Summary only?

It would be cool if someone could shed some light how these overrides are supposed to work. The Aimeos shop is already a config beast, and having it inside another config beast like TYPO3, is, wow. This is way over my head currently, it seems :-))

Sorry if this is a n00b question that has been answered already before, I gladly take any RTFM links.

Many thanks,
Tom

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Overwriting the email templates?

Post by aimeos » 06 Dec 2023, 12:44

Webrocker wrote: 05 Dec 2023, 18:30 I have a extension in

Code: Select all

typo3conf/ext/my_shop/
where, aside from the TYPO3 stuff, there is a

Code: Select all

typo3conf/ext/my_shop/Resources/Private/Extensions/aimeos/
directory which contains the stuff that a "aimeos" extension (not the aimeos TYPO3 extension) has. Config, Setup, etc and a Template directory.

In that Template directory I can add modifications, for example for the price partial:

Code: Select all

typo3conf/ext/my_shop/templates/client/html/common/partials/price.php
This works, and I see the changes in the front end.
That shouldn't work because the directory is (replace "<ext>" with your extension name):

Code: Select all

typo3conf/ext/<ext>/Resources/Private/Extensions/<ext>/templates/client/html/common/partials/price.php
Webrocker wrote: 05 Dec 2023, 18:30 Now if I try to overwrite the above mentioned controller-jobs templates

Code: Select all

typo3conf/ext/my_shop/templates/controller/jobs/order/email/html.php
This is the correct path for your file:

Code: Select all

typo3conf/ext/<ext>/Resources/Private/Extensions/<ext>/templates/controller/jobs/order/email/html.php
Webrocker wrote: 05 Dec 2023, 18:30 If I set this template file via the TypoScript settings directly at the cronjob setup, it only works if I give the absolute path there -- like

Code: Select all

controller.jobs.order.email.payment.template-html = /var/www/htdocs/typo3conf/ext/my_shop/....../html.php
By default, the template paths are relative to the ./template/ directories (specified in the typo3conf/ext/<ext>/Resources/Private/Extensions/<ext>/manifest.php file). Absolute paths work too for single files if they are not in the ./template/ directories.
Webrocker wrote: 05 Dec 2023, 18:30 I think this is a problem then if this template uses partials?
What if I need to modify the partial for the email-oder-Summary only?
Just place the partial in the same sub-directory of the ./templates/ directory in your extension as it is in the Aimeos ai-client-html extension.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Webrocker
Posts: 6
Joined: 05 Dec 2023, 17:36

Re: Overwriting the email templates?

Post by Webrocker » 06 Dec 2023, 12:55

Hi,

thanks for the fast answer!
In that Template directory I can add modifications, for example for the price partial:

typo3conf/ext/my_shop/templates/client/html/common/partials/price.php

This works, and I see the changes in the front end.

That shouldn't work because the directory is (replace "<ext>" with your extension name):

typo3conf/ext/<ext>/Resources/Private/Extensions/<ext>/templates/client/html/common/partials/price.php
you're right, but I typed the wrong path in my post. my path is

typo3conf/ext/my_shop/Resources/Private/Extensions/aimeos/templates/client/html/common/partials/price.php

But interestingly, it does work currently even if the "second" <ext> part is not "my_shop" (my exts name), but "aimeos"
(I tried that thinking, maybe it needs the name of the typo3 extension that it is overwriting, it was "my_shop" initially).

Ok but anyways, thanks for the infos, really appreciated.
I think we overlooked the manifest.php role.

A follow-up question - are the .mjml files compiled to .php automagically, or do I need to compile them if I would need to make fundamental (html) markup changes for the template?


thx,
Tom
Last edited by Webrocker on 06 Dec 2023, 13:10, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Overwriting the email templates?

Post by aimeos » 08 Dec 2023, 09:06

Webrocker wrote: 06 Dec 2023, 12:55 But interestingly, it does work currently even if the "second" <ext> part is not "my_shop" (my exts name), but "aimeos"
(I tried that thinking, maybe it needs the name of the typo3 extension that it is overwriting, it was "my_shop" initially).
The name of the second directory is not relevant because all directories in the ./Resources/Private/Extensions/ directory are scanned and included automatically.
Webrocker wrote: 06 Dec 2023, 12:55 A follow-up question - are the .mjml files compiled to .php automagically, or do I need to compile them if I would need to make fundamental (html) markup changes for the template?
They need to be translated manually and we use VSCode for that because there's an extension for MJML files available.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply