It is possible to trigger it when the customer save the order. Do I need to trigger it manually? Customer are CashPayment only (no paypal) and I see in the source code, some trigger call into Paypal processor. like
You can trigger any notification with the Notification singleton programatically whenever you need it to fire. In cases where you want full control, it's often easier to create your own trigger and monitor classes - this allows you to use your own models, but inheriting from
How I can test that? I create an order confirmation and set the trigger on "Order confirmation (Razor)". Then I capture some funds in open order (CashPayment provider) but nothing append. How can I check if some error occurred?
OK after some test.
I find a way to stop on my breakpoint inside my OrderCOnfirmation razor view one time! Hitting F5, the email was never received. I made a second check in my web config to be sure that SMTP information is correct. Then I change the send From info on Merchello Notification Gateway and retry. This time the breakpoint does not reach anymore and no email received.
Do we have some logs on the send email process?
Thanks
Help Help Help!
I am lost and this is the only point I need to set to finish this project.
I just install Merchello 2.4 and erase all the Notification.
Then I create all possible notification
Order confirmation example:
But nothing... Customer never receive mail.
The computer can send email I test it with telnet. Web condig are set like this:
Are you receiving the Order Confirmation email after you've completed the order?
The other triggers need to be setup in your application (generally as event handlers). The reason they are not added by default is there are loads of different workflow nuisances (when to trigger, what specific status, only for certain orders ... etc) and hard coding them in the starter kit would force the implementer to write their own Monitor.
Example -
An event handler I use pretty often is:
OrderService.StatusChanged += OrderServiceOnStatusChanged;
/// <summary>
/// Handles the order status changed event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The event arguments.
/// </param>
private static void OrderServiceOnStatusChanged(IOrderService sender, StatusChangeEventArgs<IOrder> e)
{
foreach (var order in e.StatusChangedEntities)
{
if (order.OrderStatusKey == Merchello.Core.Constants.DefaultKeys.OrderStatus.Fulfilled)
{
Merchello.Core.Notification.Trigger("OrderFulfilled", order, Topic.Notifications);
}
}
}
If you have the template setup, the order confirmation should be fired by FastTrack. Do you have your SMTP settings setup in for the provider in the back office? Gateways screen ... edit the provider.
Yes, it works now. Some obscure problem with our SMTP server. But now How I can't remove all the notification that I made! ;-)
When I open a notification (Ex: shipping notification) then use the arrow of the save button and select "delete" I got: Notification Deletion failed.
EDIT. I deactivate the whole provider and all the notification are gone.
Did you found a way how to render total price to the email notification ?
Im totaly frustrated , I tried almost everything and still didnt figured how to make it .
Hope you will have some time to help me .
Here is a really basic one for an example. Disclaimer, I did not spend any time on styling =)
@inherits Merchello.Web.Mvc.MerchelloHelperViewPage<Merchello.Core.Models.MonitorModels.IPaymentResultMonitorModel>
@using Merchello.Core
@using Merchello.Core.Models
@*
MerchelloHelperViewPage<T> inherits from UmbracoViewPage<t> and exposes the MerchelloHelper as 'Merchello'
Example usage: var product = Merchello.TypedProductContent(YOURPRODUCTKEY);
*@
@{
var invoice = Model.Invoice;
var billingAddress = invoice.GetBillingAddress();
var customerName = billingAddress.Name;
var shippingTotal = invoice.ShippingLineItems().Sum(x => x.TotalPrice).AsFormattedCurrency();
var taxTotal = invoice.TaxLineItems().Sum(x => x.TotalPrice).AsFormattedCurrency();
var invoiceTotal = invoice.Total.AsFormattedCurrency();
}
<p>Dear @customerName,</p>
<p>Thank you for your recent purchase from the FastTrack store.</p>
<strong>Invoice #: @invoice.PrefixedInvoiceNumber()</strong>
<table>
<thead>
<tr>
<th>Name</th>
<th>Sku</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach (var item in invoice.Items.Where(x => x.LineItemType == LineItemType.Product))
{
<tr>
<td>@item.Name</td>
<td>@item.Sku</td>
<td>@item.Price.AsFormattedCurrency()</td>
<td>@item.TotalPrice.AsFormattedCurrency()</td>
</tr>
}
<tr>
<td colspan="2" style="text-align: right"><b>Shipping:</b></td>
<td>@shippingTotal</td>
</tr>
<tr>
<td colspan="2" style="text-align: right"><b>Tax:</b></td>
<td>@taxTotal</td>
</tr>
<tr>
<td colspan="2" style="text-align: right"><b>Total:</b></td>
<td>@invoiceTotal</td>
</tr>
</tbody>
</table>
Testing the email, I get this:
Dear Current Customer,
Thank you for your recent purchase from the FastTrack store.
Invoice #: FT-675
Name Sku Unit Price Total
Element Meh Shirt - Small Red tshrt-meh-small-red $14.29 $14.29
Shipping: $10.00
Tax: $0.00
Total: $24.29
Hi Rusty,
Thanks for template it helped a lot . But i still have one question , is the SLOVAK language supported in email notification ? Maybe it strange question , but when i use slovak language in it , theres plenty of special symbols instead of letters. I dont use any specific font.
The only thing I can think of that may need to be tweaked in that process is the thread culture ... but it should render the same way as the application.
In whole website is Slovak language rendered very well, just in email notification it makes problems.
I used your order confirmation template just added couple text paragraphs with slovak.
This is how it looks like
tovar zaplatĂte aĹľ po doruÄŤenĂ na Vašu
Is there a chance to fix it or use some workaround to render text properly ?
Also I has to say that merchello is really great built e-commerce , I really like it , wish you all the best in continuing .
Thanks
Guessing it may have something to do with the culture used in the thread executing the ViewRender - but to be honest, I've not run into it before and may need a hand figuring this one out.
In order for me to be correct, your servers culture (default thread culture) would have to be different than that of Umbraco's AND Umbraco must be setting the culture in their view rendering process - which is something we should be able to find in the UmbracoCMS source.
Of course I could be completely wrong here - but it's somewhere to start looking.
Yeah I was thinking about META tags but when i put them into e-mail template i wont work . I tried to find place where to put it but I found nothing . Maybe its stupid , but this is my first time working with system like this.
Where can I find file where to put it ?
So if I get it right, i just need to create .cs file with whatever name , put code you provided in it and it should work ? Also which namespace should I use ?
using System;
public class UmbracoApplicationEventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
SmtpNotificationGatewayMethod.Sending += SmtpNotificatoinGatewayMethod_Sending;
}
private void SmtpNotificatoinGatewayMethod_Sending(SmtpNotificationGatewayMethod sender, Core.Events.ObjectEventArgs<System.Net.Mail.MailMessage> e)
{
var msg = e.EventObject;
msg.BodyEncoding = System.Text.Encoding.UTF8;
}
}
Theres no App_Code folder in my project , is there a possibility that it will be a Properties folder ?
Email template on order received
I copied the simple template Rusty propsed from this post (I can't post it here, the code block do not accept it)
https://our.umbraco.org/projects/collaboration/merchello/merchello/81655-merchello-notification-on-order-confirmation
It is possible to trigger it when the customer save the order. Do I need to trigger it manually? Customer are CashPayment only (no paypal) and I see in the source code, some trigger call into Paypal processor. like
How and where I can do that?
The OrderConfirmation is triggered in the
CheckoutPaymentControllerBase
class but can be overridden (it's virtual)https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Controllers/CheckoutPaymentControllerBase%7BT%7D.cs#L163
You can trigger any notification with the Notification singleton programatically whenever you need it to fire. In cases where you want full control, it's often easier to create your own trigger and monitor classes - this allows you to use your own models, but inheriting from
Monitor base:
https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Core/Gateways/Notification/Monitors/NotificationMonitorBase.cs
and Trigger base:
https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Core/Gateways/Notification/Triggering/NotificationTriggerBase.cs
How I can test that? I create an order confirmation and set the trigger on "Order confirmation (Razor)". Then I capture some funds in open order (CashPayment provider) but nothing append. How can I check if some error occurred?
The order confirmation is usually triggered at the end of a checkout not when you capture a payment.
OK after some test. I find a way to stop on my breakpoint inside my OrderCOnfirmation razor view one time! Hitting F5, the email was never received. I made a second check in my web config to be sure that SMTP information is correct. Then I change the send From info on Merchello Notification Gateway and retry. This time the breakpoint does not reach anymore and no email received.
Do we have some logs on the send email process? Thanks
Does someone use this kind of template? Can you share the config that you use and the razor file that you use? I am stuck with this. Thanks
Help Help Help! I am lost and this is the only point I need to set to finish this project. I just install Merchello 2.4 and erase all the Notification.
Then I create all possible notification
Order confirmation example:
But nothing... Customer never receive mail. The computer can send email I test it with telnet. Web condig are set like this:
Do I need to create some views? Can I test something or found some logs about email sending? Thanks a lot.
PS: I try make order, partially ship and complete ship to trigger all notifications.
Did you hit the "Create" button and verify the view was written to /Views/Merchello/Notifications/ ?
Yes an, for now i just add Test in the default view created.
Are you receiving the Order Confirmation email after you've completed the order?
The other triggers need to be setup in your application (generally as event handlers). The reason they are not added by default is there are loads of different workflow nuisances (when to trigger, what specific status, only for certain orders ... etc) and hard coding them in the starter kit would force the implementer to write their own
Monitor
.Example - An event handler I use pretty often is:
No, never receive OrderConfirmation...
Where to you put this code?
If you have the template setup, the order confirmation should be fired by FastTrack. Do you have your SMTP settings setup in for the provider in the back office? Gateways screen ... edit the provider.
Yes, it works now. Some obscure problem with our SMTP server. But now How I can't remove all the notification that I made! ;-) When I open a notification (Ex: shipping notification) then use the arrow of the save button and select "delete" I got: Notification Deletion failed.
EDIT. I deactivate the whole provider and all the notification are gone.
Hey Pierre - can you log the issue you had with your delete and give me some steps to follow ...
http://issues.merchello.com
I will do.
Did you create a confirmation razor template for FastTrack that display order information like the ftReceipt?
Hi Pierre,
Did you found a way how to render total price to the email notification ? Im totaly frustrated , I tried almost everything and still didnt figured how to make it . Hope you will have some time to help me .
Thank you a lot .
@krzakivan - the email body is straight razor.
Here is a really basic one for an example. Disclaimer, I did not spend any time on styling =)
Testing the email, I get this:
Thanks Rusty. I will start with that...
Do you know where I can change the section on html email template?
Hi Rusty,
Thanks for template it helped a lot . But i still have one question , is the SLOVAK language supported in email notification ? Maybe it strange question , but when i use slovak language in it , theres plenty of special symbols instead of letters. I dont use any specific font.
Thanks
Hi Krzakivan,
I assume it would be the same as rendering SLOVAK in any razor view, but honestly don't know the particulars myself.
Merchello is using a rendering engine behind the scenes to compile the view - https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Mvc/ViewRenderer.cs#L81
The only thing I can think of that may need to be tweaked in that process is the thread culture ... but it should render the same way as the application.
What are you encountering?
In whole website is Slovak language rendered very well, just in email notification it makes problems.
I used your order confirmation template just added couple text paragraphs with slovak.
This is how it looks like
Is there a chance to fix it or use some workaround to render text properly ?
Also I has to say that merchello is really great built e-commerce , I really like it , wish you all the best in continuing . Thanks
Guessing it may have something to do with the culture used in the thread executing the ViewRender - but to be honest, I've not run into it before and may need a hand figuring this one out.
In order for me to be correct, your servers culture (default thread culture) would have to be different than that of Umbraco's AND Umbraco must be setting the culture in their view rendering process - which is something we should be able to find in the UmbracoCMS source.
Of course I could be completely wrong here - but it's somewhere to start looking.
Would you write up an issue in http://issues.merchello.com ...
I asked the question on Twitter and got a response that, thankfully reeled things back in a bit.
https://twitter.com/JamesMSouth/status/834526085064699904
Hi Rusty ,
That seem to be good idea. But I don't know where to change it. Can you help me navigate ?
https://www.w3schools.com/tags/tag_meta.asp
Yeah I was thinking about META tags but when i put them into e-mail template i wont work . I tried to find place where to put it but I found nothing . Maybe its stupid , but this is my first time working with system like this. Where can I find file where to put it ?
Yep - that's an issue. The headers need to be set on the MailMessage.
You can try handling the
SmtpNotificationGatewayMethod.Sending
event which fires before the smtp client sends the message.Something like this?
Is it possible to make this change even in running project ? I've been looking for a file where to put it . And cannot find nothing .
I'm sorry for my stupid questions , I more of a designer than a developer , so there are still lot of stuff to figure out.
The code above is a c# class (I think I'm missing the final closing } ) in the snippet above.
You should be able to add it to your solution and compile - Umbraco will resolve the event handlers when it bootstraps.
If you want, you can quickly add it to the App_Code folder (put a namespace around it first) and see if it does the trick.
So if I get it right, i just need to create .cs file with whatever name , put code you provided in it and it should work ? Also which namespace should I use ?
Theres no App_Code folder in my project , is there a possibility that it will be a Properties folder ?
AppCode is special folder used by asp.net. You can just add it to the application root ... /AppCode.
Namespace is just a way to organize the code - so it can be anything.
is working on a reply...