Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

order notify via email


Go to End


4 Posts   1509 Views

Avatar
t00thy

Community Member, 31 Posts

1 June 2011 at 12:09am

Hi,

have anybody know how to creat the notification via e-mail for new orders? Simply it could be the copy of email that has sent to customers. Where can I edit the code?

Avatar
inCharge

Community Member, 102 Posts

1 June 2011 at 3:27am

The code is already there in order.php. See Order::sendReceipt and Order::sendEmail

See the .ss files in the directory ecommerce/templates/email

I haven't got this far yet, but I guess you copy those to...

themes/mytheme_ecommerce/templates/email

...and amend as necessary.

Note that any css must be inline, because these are html email templates, not html web pages.

Avatar
t00thy

Community Member, 31 Posts

1 June 2011 at 9:27pm

Thanks so much. I found function $copyToAdmin = true, but the copy did not work for me... so I check the _config file and TaDaa... there was wrong email.

Thank you.

Avatar
inCharge

Community Member, 102 Posts

2 June 2011 at 1:42am

Edited: 02/06/2011 1:44am

Toothy, now it's my turn to thank you! I didn't know about copyToAdmin or Email::setAdminEmail, but emails to the store owner were next up on my list.

Email::setAdminEmail should probably be in most _config.php files, ecommerce or not.

This is what I have in _config.php now...

// Default email sender address for the Email class
// Also receives a copy of ecommerce receipt emails
Email::setAdminEmail('support@mysite.com');

// Sender & subject for ecommerce receipt emails
Order::set_email("Name <sales@mysite.com>");
Order::set_subject("thank you for your order at www.mysite.com");

Note:
- If Email::setAdminEmail is not defined, no receipt is sent to the shop owner - just the customer

- If Email::setAdminEmail is defined, but not Order::set_email, then setAdminEmail is also the sender of receipts. If neither are defined, the sender of receipts is empty.

- Order::set_email can include a name
e.g. 'MySite Sales <sales@mysite.com>'
...but Email::setAdminEmail must include just the email address without a name
e.g. 'sales@mysite.com'
...otherwise the receipt emails don't arrive.

- The Debug::friendlyError function code implies that Email::setAdminEmail is also shown in error pages when no corresponding error page is set up in the CMS (although I didn't test this)