FriendsOfShopware / FroshPlatformTemplateMail

This plugin allows you to use twig mails in Shopware 6.
MIT License
23 stars 17 forks source link

Multiple Templates per Type #62

Closed iMiMWeis closed 1 week ago

iMiMWeis commented 9 months ago

I have exported templates to files using the frosh:template-mail:export command. I have noticed, that some templates were not created, due to them being assigned to the same type.

It would be great if this plugin supported multiple templates per type.

Currently the identifier for email templates is the template type. However this would not work with multiple templates per type.

amenk commented 9 months ago

Not so much only a problem of the export command, might also be a problem on how to assign those different templates (we could add a .1,.2 and so on suffix during the export) in the flow builder, right?

fgiering commented 5 months ago

Isn't this as easy as it sounds?

amenk commented 1 month ago

Not sure, about how to assign them in the flow builder. The export is probably not the problem. Is this what you mean @fgiering ?

fgiering commented 1 month ago

grafik grafik We always put a description in the description field. The flow-builder is showing this to seperate between same template-types. Does the plugin export and import the description field? Isn't this an "replace-problem" on the import of the same teamplate-type?

amenk commented 1 month ago

As I understand it, the plugin does not import anything.

There is a export-to-theme function which creates the twig files based on the type of the mails in the database. Then, when sending emails, the extensions seems to pick up the template from the filesystem, based on the type.

If you have multiple different templates with the same type and chose different ones in the flow builder, still both templates of that type would pull the same template.

This is also visible in the email template list:

image

It needs some concept how to implement that. Maybe in the database, a twig template could be linked and we still could create email template entries in the admin panel.

fgiering commented 1 month ago

Yes. I see. Some mapping would be necessary.

amenk commented 1 month ago

@shyim what do you think about this?

amenk commented 1 month ago

Idea would be to store the templates like this ...

$targetFile = sprintf('%s/%s/%s.twig', $templateDir, Uuid::fromBytesToHex($record['id']), $name);

File tree

amenk commented 1 month ago

Implemented in #75


What's still seems to be missing the the indication in the admin panel, that a template is overwritten. EDIT: it is working, just forgot to build admin assets