Turning off order shipment email
- freeweaver
- Ensign (ENS)
- Posts: 8
- Joined: Mon Apr 18, 2011 11:46 am
Turning off order shipment email
I'm trying to enter and order shipment without sending off email notification.
I added a checkbox to let a user choose whether to send notification and I'm able to skip over the part where I manually build an email, but I find later on, a call to OrderDataSource.Load send a shipment notification email anyway.
Is there a way to stop that from happening?
I added a checkbox to let a user choose whether to send notification and I'm able to skip over the part where I manually build an email, but I find later on, a call to OrderDataSource.Load send a shipment notification email anyway.
Is there a way to stop that from happening?
Re: Turning off order shipment email
Go to Admin > Configure > Email > Templates and click the edit icon for the Customer Order Notification template. Then click the the Event Triggers tab to uncheck the triggers that you don't want.
- freeweaver
- Ensign (ENS)
- Posts: 8
- Joined: Mon Apr 18, 2011 11:46 am
Re: Turning off order shipment email
That stopped the automatic email from sending, but when I explicitly call the email send it doesn't send anymore.
Here's the code snippet. When the condition is true, I don't get the email:
Here's the code snippet. When the condition is true, I don't get the email:
Code: Select all
if (SendNotificationCheckbox.Checked)
{
EmailTemplateCollection emailTemplates = null;
if (!isPartial)
{
emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Order Shipped' ");
}
else
{
emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Order Shipped Partial' ");
}
if (emailTemplates != null && emailTemplates.Count > 0)
{
emailTemplates[0].Parameters.Add("store", _OrderShipment.Order.Store);
emailTemplates[0].Parameters.Add("customer", _OrderShipment.Order.User);
emailTemplates[0].Parameters.Add("order", _OrderShipment.Order);
emailTemplates[0].Parameters.Add("payments", _OrderShipment.Order.Payments);
emailTemplates[0].ToAddress = _OrderShipment.Address.Email;
emailTemplates[0].Send();
}
}
Re: Turning off order shipment email
Looks good to me. What if you tried:
emailTemplates[0].ToAddress = _OrderShipment.Order.BillToEmail;
instead of
emailTemplates[0].ToAddress = _OrderShipment.Address.Email; ??
emailTemplates[0].ToAddress = _OrderShipment.Order.BillToEmail;
instead of
emailTemplates[0].ToAddress = _OrderShipment.Address.Email; ??
- freeweaver
- Ensign (ENS)
- Posts: 8
- Joined: Mon Apr 18, 2011 11:46 am
Re: Turning off order shipment email
That definitely fixed the immediate problem, kind of, but here's the weird part:
If I go through the process in order manager as a new user, that initial email field is populated.
If I initially choose an existing user to create that order, that initial email field is not populated and I have to roll over to the Order.BillToEmail.
Any idea why that is? I'm working on tracking it down right now.
If I go through the process in order manager as a new user, that initial email field is populated.
If I initially choose an existing user to create that order, that initial email field is not populated and I have to roll over to the Order.BillToEmail.
Any idea why that is? I'm working on tracking it down right now.
Re: Turning off order shipment email
Can you please explain it again? Specially this par "roll over to the Order.BillToEmail". It would be better if you provide some details about how to produce the case and what are you expecting the output to be.freeweaver wrote:That definitely fixed the immediate problem, kind of, but here's the weird part:
If I go through the process in order manager as a new user, that initial email field is populated.
If I initially choose an existing user to create that order, that initial email field is not populated and I have to roll over to the Order.BillToEmail.
Any idea why that is? I'm working on tracking it down right now.
- freeweaver
- Ensign (ENS)
- Posts: 8
- Joined: Mon Apr 18, 2011 11:46 am
Re: Turning off order shipment email
In my code sample above, I mentioned I'm looking for the OrderShipment.Address.Email.
When I place an order as a new, unregistered user, there's a value in that field.
When I place an order as an existing, registered user, there isn't, and I'm not sure why. I'm expecting a value to be in that field no matter what.
I'm wondering why it isn't there.
When I place an order as a new, unregistered user, there's a value in that field.
When I place an order as an existing, registered user, there isn't, and I'm not sure why. I'm expecting a value to be in that field no matter what.
I'm wondering why it isn't there.
Code: Select all
if (SendNotificationCheckbox.Checked)
{
EmailTemplateCollection emailTemplates = null;
if (!isPartial)
{
emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Order Shipped' ");
}
else
{
emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Order Shipped Partial' ");
}
if (emailTemplates != null && emailTemplates.Count > 0)
{
emailTemplates[0].Parameters.Add("store", _OrderShipment.Order.Store);
emailTemplates[0].Parameters.Add("customer", _OrderShipment.Order.User);
emailTemplates[0].Parameters.Add("order", _OrderShipment.Order);
emailTemplates[0].Parameters.Add("payments", _OrderShipment.Order.Payments);
emailTemplates[0].ToAddress = _OrderShipment.Address.Email;
emailTemplates[0].Send();
}
}