trigger email for specific payment method?
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
trigger email for specific payment method?
My client needs notification emails sent for the case of purchases using a specific payment method (Purchase Orders) only.
The way I see it, my options are:
*custom trigger for this case
*use the normal, "order placed" trigger, with special email content (like order status or payment method) so that non-PO orders can be filtered on the server or by the email client
*Commandeer some sort of inventory/vendor-related event trigger to happen for PO orders, since my client is not tracking inventory (I'm getting creative).
Does anyone have experience with custom triggers for email templates?
Is the case still as it was in 2008, that I need to programmatically generate the email in the code where the 'trigger' event occurs, and custom triggers are not possible?
Kind regards,
Crockett
The way I see it, my options are:
*custom trigger for this case
*use the normal, "order placed" trigger, with special email content (like order status or payment method) so that non-PO orders can be filtered on the server or by the email client
*Commandeer some sort of inventory/vendor-related event trigger to happen for PO orders, since my client is not tracking inventory (I'm getting creative).
Does anyone have experience with custom triggers for email templates?
Is the case still as it was in 2008, that I need to programmatically generate the email in the code where the 'trigger' event occurs, and custom triggers are not possible?
Kind regards,
Crockett
Re: trigger email for specific payment method?
Yes you can't add any custom trigger and you will be needing to place code for email from where you want to trigger it. In your case since you only want to send Email for a specific payment method I think one way to do this could be to remove all triggers from order placed email template. Then you need to place code in OnePageCheckout.ascx.cs control's CheckedOut event handler. There you can decide depending upon payment method if you need to send email or not.crockettdunn wrote:Does anyone have experience with custom triggers for email templates?
Is the case still as it was in 2008, that I need to programmatically generate the email in the code where the 'trigger' event occurs, and custom triggers are not possible?
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
Re: trigger email for specific payment method?
Thanks, Mazhar! I'll give it a shot.
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
Re: trigger email for specific payment method?
Mazhar,
Is your suggestion to remove all triggers from the "order placed" email template un-related to the code (just to prevent duplicate emails for placing a PO order)?
I'm talking about a merchant notification only for PO orders, so I hope I can still have the customer email notifications for ALL orders as well.
Is your suggestion to remove all triggers from the "order placed" email template un-related to the code (just to prevent duplicate emails for placing a PO order)?
I'm talking about a merchant notification only for PO orders, so I hope I can still have the customer email notifications for ALL orders as well.
Re: trigger email for specific payment method?
Yes its not related to code I was thinking about duplicate orders.But since you just need it for merchant then I think you don't need it to remove all triggers. Custom Email code will simply send it to merchant email address in case of PO.
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
Re: trigger email for specific payment method?
Thanks. But I asked the wrong question (juggling too many things today!).
I'm wondering if I specify an EMAIL (under where it reads "select emails") on THIS screen:
Will changes be reflected on the Configure > Email > Templates page?
In other words we're using the same set of triggers and email templates for both?
I'm wondering if I specify an EMAIL (under where it reads "select emails") on THIS screen:
Will changes be reflected on the Configure > Email > Templates page?
In other words we're using the same set of triggers and email templates for both?
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
Re: trigger email for specific payment method?
Since I don't know how to write the code to trigger a special order status based on a specific payment method, I think the best I can do from a business process standpoint is to make a merchant order notification email with content that varies based on payment type. Then they can use their email system for flagging orders and routing to the appropriate personnel.
- crockettdunn
- Lieutenant Commander (LCDR)
- Posts: 105
- Joined: Sun Oct 26, 2008 6:32 pm
- Contact:
Re: trigger email for specific payment method?
... but it would be better to programmatically set the order status, if anyone can point me in the right direction.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: trigger email for specific payment method?
This is not exactly what you want, but it was all I could find quickly. You can use this pattern, but you will have to experiment with it.
Code: Select all
EmailTemplate template = EmailTemplateDataSource.Load(Token.Instance.Store.Settings.ProductTellAFriendEmailTemplateId);
if (template != null)
{
//STRIP HTML
Name.Text = StringHelper.StripHtml(Name.Text);
FromEmail.Text = StringHelper.StripHtml(FromEmail.Text);
FriendName.Text = StringHelper.StripHtml(FriendName.Text);
FriendEmail.Text = StringHelper.StripHtml(FriendEmail.Text);
// ADD PARAMETERS
template.Parameters["store"] = Token.Instance.Store;
template.Parameters["product"] = product;
template.Parameters["category"] = category;
template.Parameters["fromEmail"] = FromEmail.Text;
template.Parameters["fromName"] = Name.Text;
template.FromAddress = FromEmail.Text;
template.ToAddress = FriendEmail.Text;
template.Send();
FriendEmail.Text = string.Empty;
SentMessage.Visible = true;
}
else
{
FailureMessage.Text = "Email template could not be loaded.";
FailureMessage.Visible = true;
}
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx