https://github.com/FriendsOfShopware/FroshPlatformTemplateMail
This plugin allows you to use twig mails in Shopware 6.
https://github.com/FriendsOfShopware/FroshPlatformTemplateMail
Last synced: 7 days ago
JSON representation
This plugin allows you to use twig mails in Shopware 6.
- Host: GitHub
- URL: https://github.com/FriendsOfShopware/FroshPlatformTemplateMail
- Owner: FriendsOfShopware
- License: mit
- Created: 2019-11-28T21:14:05.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T21:25:09.000Z (9 months ago)
- Last Synced: 2024-10-29T22:51:38.617Z (9 months ago)
- Language: PHP
- Homepage:
- Size: 262 KB
- Stars: 22
- Watchers: 4
- Forks: 17
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Store Shopware mail templates in theme
[](https://codecov.io/gh/FriendsOfShopware/FroshPlatformTemplateMail)
[](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/actions/workflows/unit.yml)
[](https://slack.shopware.com?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)This plugin allows to store the mails in theme instead of database. This gives us advantages like
* easier deployment
* translate it using snippets
* build your mail template using includes / extends / blocks / inheritance
* usage of theme configuration## Requirements
- Shopware 6.6.0 or newer
- PHP 8.2## Installation
- Download latest release
- Extract the zip file in `shopware_folder/custom/plugins/`### Export Templates
You can use the following command to export the current templates to the file system of your theme `MyTheme` to start modifying them:
```shell
bin/console frosh:template-mail:export custom/plugins/MyTheme/src/Resources/views/email/
```## Template location
Create a mail for a specific subshop or language shop (also inheritance in shops works)
Search order in example with sOrder:
custom/plugins/FroshPlatformTemplateMail/src/Resources/views/email/global/order_transaction.state.paid/html.twig
* HTML Template
* `custom/plugins/MyTheme/src/Resources/views/email/[en-GB]/order_transaction.state.paid/html.twig` (Language Locale)
* `custom/plugins/MyTheme/src/Resources/views/email/[en-GB]/order_transaction.state.paid/[ID]/html.twig` (Template ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/html.twig` (Saleschannel ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/html.twig` (Language ID)
* `custom/plugins/MyTheme/src/Resources/views/email/global/order_transaction.state.paid/html.twig` (Default)
* Database saved values (for right template names search in database table `mail_template_type`)
* Text Template
* `custom/plugins/MyTheme/src/Resources/views/email/[en-GB]/order_transaction.state.paid/plain.twig` (Language Locale)
* `custom/plugins/MyTheme/src/Resources/views/email/[en-GB]/order_transaction.state.paid/[ID]/plain.twig` (Template ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/plain.twig` (Saleschannel ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/plain.twig` (Language ID)
* `custom/plugins/MyTheme/src/Resources/views/email/global/order_transaction.state.paid/plain.twig` (Default)
* Database saved values (for right template names search in database table `mail_template_type`)
* Subject Template
* `custom/plugins/MyTheme/src/Resources/views/email/[en-GB]/order_transaction.state.paid/subject.twig` (Language Code)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/[ID]/subject.twig` (Template ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/subject.twig` (Saleschannel ID)
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/order_transaction.state.paid/subject.twig` (Language ID)
* `custom/plugins/MyTheme/src/Resources/views/email/global/order_transaction.state.paid/subject.twig` (Default)
* Database saved values (for right template names search in database table `mail_template_type`)* You can also nest templates. E.g.:
* `custom/plugins/MyTheme/src/Resources/views/email/[ID]/[en-GB]/order_transaction.state.paid/html.twig` (Saleschannel ID)/(Language Locale)## MJML Support
The plugin supports [MJML](https://mjml.io/). In the standard configuration mail templates in MJML format are processed via the service https://mjml.shyim.de.
## Known Limitations
* The test mail function in the admin panel does not support the overwritten mail templates. ([#34](https://github.com/FriendsOfShopware/FroshPlatformTemplateMail/issues/34)).
## Contributing
Feel free to fork and send pull requests!
## Licence
This project uses the [MIT License](LICENCE.md).