fooman / emailattachments-implementation-m2

Implementation package for https://github.com/fooman/emailattachments-m2
14 stars 7 forks source link

Flexible E-Mail-Template-Types? #21

Open wilfriedwolf opened 2 years ago

wilfriedwolf commented 2 years ago

Hi there,

I just had a project, where I needed to add different Identities to Invoice and Creditmemo Mails, so having two different types of invoice and creditmemo emails. This worked out nicely. Unfortunately these new Mail-Type-Variants would not allow the same attachment behaviour as the standard mails, since they would use another template config path.

I could solve my problem by overriding the \Fooman\EmailAttachments\Model\EmailIdentifier but since here lots of stuff is private this leads to a serious copy and paste problem.

So my idea was to switch the hardcoded stuff to a DI driven one. If you think that would be a nice idea, I could just prepare a Pull request..

What do you think.

Best regards,

Willi

fooman commented 2 years ago

Hi Willi

thanks for getting in touch. The intended extension point would be to add an after plugin on \Fooman\EmailAttachments\Model\EmailIdentifier::getType() where you can supply your custom logic if the default one doesn't work for you.

Allowing additional templates to be categorised along side the default ones could make sense. Instead of a di.xml approach it may also work by just having the paths in config.xml - happy to merge either of those approaches if you want to create a PR as long as existing custostomisations on getType() would not break.