Separate mails for shop owner and customer - no bcc

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
boettner
Posts: 84
Joined: 09 Feb 2015, 17:49

Separate mails for shop owner and customer - no bcc

Post by boettner » 28 Feb 2020, 11:03

Hi,

is it easily possible to split email notification of new orders (payment received) and to send emails with different content to customer and the shop owner? Using BCC the owner and the customer would receive the same mail.

I know that I have to split the email jobs and configure different template paths there but how can I set a fixed "TO:" mail address that receives the owner mails? Is it possible without writing decorator or extending the existing Aimeos\Controller\Jobs\Order\Email\Payment?

Best
Robert.

boettner
Posts: 84
Joined: 09 Feb 2015, 17:49

Re: Separate mails for shop owner and customer - no bcc

Post by boettner » 28 Feb 2020, 13:48

One followup question:
When doing it by extending/decorating how would one possibly handle mail sent/not sent status best if emails get sent by two jobs in parallel?

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

Re: Separate mails for shop owner and customer - no bcc

Post by aimeos » 28 Feb 2020, 13:58

You should write an "Email" decorator for the service providers that sends an e-mail to the configured address:
https://github.com/aimeos/aimeos-core/t ... /Decorator

Then, these e-mails are sent when the job controllers for delivery and/or payment status updates (aka confirmation e-mails) are executed. We would love to get a contribution for this feature from you :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Posts: 84
Joined: 09 Feb 2015, 17:49

Re: Separate mails for shop owner and customer - no bcc

Post by boettner » 28 Feb 2020, 14:17

Ah, that´s a new track that should make my second question unnecessary. Thanks! Building upon the existing providers should be no problem. What I don´t understand yet is how is this new provider going to be called?

Merging back should be no problem. Do I have to consider anything special since we are still on 18.10?

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

Re: Separate mails for shop owner and customer - no bcc

Post by aimeos » 28 Feb 2020, 14:35

It's a decorator and it's stacked upon the configured provider in the service panel of the admin interface. You should decorate the processBatch() method and send an e-mail if it's called (done when the order/service/delivery job is run by the cronjob).

2018.10 doesn't use return type hints compared to dev-master.

Please remind yourself, that LTS support for 2018.10 has run out and if you want to continue using that version securely, you need ELTS support from the Aimeos company:

https://aimeos.com/support#c427
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Posts: 84
Joined: 09 Feb 2015, 17:49

Re: Separate mails for shop owner and customer - no bcc

Post by boettner » 20 Mar 2020, 15:44

I could continue my work on the Decorator today. Setting it up like suggested, stacking the new Email Decorator upon the existing ones like for example on the payment "PrePay,Email", the Decorator gets executed in the address step during checkout. It is configured nowhere else. I would like to set it up that it´s executed after the payment has been authorized which occurs automatically in this setup since we only offer paying by invoice, meaning at the very end of the checkout process. Like it´s done with the regular email notifications.

And another question in advance on this topic: how can use the existing email templates for my custom notification?

A nice and weekend to everyone. Stay healthy!

Robert.

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

Re: Separate mails for shop owner and customer - no bcc

Post by aimeos » 22 Mar 2020, 10:53

Stack your decorator on top of the delivery service provider, not the payment service provider.

For using templates, you can have a look at the XML deliver service provider as reference:
https://github.com/aimeos/aimeos-core/b ... ry/Xml.php
You can simplify configuration because you probably don't need configurable templates.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Posts: 84
Joined: 09 Feb 2015, 17:49

Re: Separate mails for shop owner and customer - no bcc

Post by boettner » 23 Mar 2020, 10:30

Thanks for the suggestions.

What do I have to ensure when stacking it on top of the delivery providers regarding isAvailable()? True returns all delivery options as valid, false none. Both won´t work.

That´s the current stack: Manual,Weight,Country,Email

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

Re: Separate mails for shop owner and customer - no bcc

Post by aimeos » 24 Mar 2020, 11:46

Decorators are stacked from left to right, so the right-most is on top.
If you don't overwrite the isAvailable() method, the result from the next decorator is passed back:
https://github.com/aimeos/aimeos-core/b ... e.php#L140
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply