Access to config parameters in mjml mails

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!
cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Access to config parameters in mjml mails

Post by cnoelker » 18 Aug 2020, 10:19

Hello,
I am configuring a value like this in the TypoScript setup in TYPO3:
plugin.tx_aimeos.settings.client.html.common.sizes {
36 = 1020
38 = 1021
[shortened a bit...]
}

In the summary of the shop, I can properly access these as
$allSizes = $this->config( 'client/html/common/sizes', array());

But, when I use the same programming code inside the mjml file (which is transformed to PHP), then the array $allSizes is empty!

Is this a bug? What can I do?
Claudia

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

Re: Access to config parameters in mjml mails

Post by aimeos » 19 Aug 2020, 07:31

No bug, if you add a frontend configuration (plugin.tx_aimeos....) it's not available in the scheduler tasks because TYPO3 keeps them separate. Either to add the config to the TSConfig field in the scheduler task too or you move the config to the PHP config file where it will be used everywhere.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Re: Access to config parameters in mjml mails

Post by cnoelker » 19 Aug 2020, 08:03

The TS config field won't be used, when I call the task from the command line, if I remember correctly.

Which PHP config file should be used? config/client.php ?

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

Re: Access to config parameters in mjml mails

Post by aimeos » 19 Aug 2020, 20:44

Yes, ./config/client.php is the right place because is named "client/html/common/sizes"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Re: Access to config parameters in mjml mails

Post by cnoelker » 20 Aug 2020, 07:22

Thank you.
BTW, I don't really like to have to put configuration in this file, which varies depending on the system (development, test, production). After deployment of a new version of the extension, this file needs to be replaced automatically by the correct file for the system.

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

Re: Access to config parameters in mjml mails

Post by aimeos » 21 Aug 2020, 19:13

You can put your environment specific configuration in the AdditionalConfiguration.php and reference it in the Aimeos config files like for the database connection:
https://github.com/aimeos/aimeos-typo3/ ... php#L8-L17
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply