using an email template

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
RickSilver
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Jun 22, 2009 5:49 pm

using an email template

Post by RickSilver » Tue Nov 23, 2010 7:58 pm

I need to be able to add a new email template through the admin screens and then in .net code, after checkout, read the template contents (Bonus: with NVelocity variables filled in) so that I can email the contents to a data-driven dynamic email address that we are storing in a custom database table. Is this possible? We are using the latest version AC 7*.

Thanks!
Rick S

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: using an email template

Post by mazhar » Wed Nov 24, 2010 5:49 am

If you custom data is available under standard $order variables then all you need is to create new Email template in admin, assign order placed trigger to it and then do the nvelocity in its content section. Finally instead of having customer in its to address simply fill in the desired Email address where you want to send the message. If this new Email template requires some new nvelocity variables which are not available in Order Placed trigger context then you need to send the mail manually and by setting custom parameters on it.

RickSilver
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Jun 22, 2009 5:49 pm

Re: using an email template

Post by RickSilver » Mon Nov 29, 2010 10:01 pm

mazhar,
Thanks for the reply but I am somewhat confused. The custom data is an email address, but where do I "intercept" the trigger of an order so that I can substitute the customer email address with a different one? This is not an email address I know of until the order is placed. It is not a customer email address but one based on data from a custom database table.

Assuming I do have to do this manually, I'm back to my original question.

Rick

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: using an email template

Post by mazhar » Tue Nov 30, 2010 4:15 am

Seems like you will be required to trigger Email manually. Read following thread about how to send Email manually
viewtopic.php?f=42&t=13537

You need to intecept order placed in ConLib/OnePageCheckout.ascx.cs file's CheckedOut method.

RickSilver
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Jun 22, 2009 5:49 pm

Re: using an email template

Post by RickSilver » Tue Nov 30, 2010 7:34 pm

Will I be able to store the contents of the email and the NVelocity tags in an email template from the admin screen? If so, how do I access the contents of the email template in OnePageCheckout.ascx.cs?

I guess this goes back to my original question...

I need to be able to add a new email template through the admin screens and then in .net code, after checkout, read the template contents (Bonus: with NVelocity variables filled in) so that I can email the contents to a data-driven dynamic email address that we are storing in a custom database table.


If not, where can I store the email template? I don't want it hard-coded in the code.

Rick

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: using an email template

Post by mazhar » Wed Dec 01, 2010 4:58 am

If you read in detail the link that I provided in my comment above, you will see that you will create an Email template from admin side. Then from store side you will load and set parameters on that template and finally trigger Email. For example in the link that I mentioned I did something like

Code: Select all

EmailTemplateCollection emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Customer Order Notification' ");
in this case I loaded Customer Order Notification template using its name.

RickSilver
Lieutenant (LT)
Lieutenant (LT)
Posts: 66
Joined: Mon Jun 22, 2009 5:49 pm

Re: using an email template

Post by RickSilver » Wed Dec 01, 2010 8:20 am

Thank you very much.

Rick

Post Reply