Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • PierreD Savard 183 posts 290 karma points
    Jan 20, 2017 @ 19:06
    PierreD Savard
    0

    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

    Notification.Trigger("OrderConfirmation", attempt, new[] { email }, Topic.Notifications);
    

    How and where I can do that?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 23, 2017 @ 17:19
    Rusty Swayne
    0

    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

  • PierreD Savard 183 posts 290 karma points
    Feb 02, 2017 @ 16:02
    PierreD Savard
    0

    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?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 02, 2017 @ 19:50
    Rusty Swayne
    0

    The order confirmation is usually triggered at the end of a checkout not when you capture a payment.

  • PierreD Savard 183 posts 290 karma points
    Feb 06, 2017 @ 15:57
    PierreD Savard
    0

    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

  • PierreD Savard 183 posts 290 karma points
    Feb 08, 2017 @ 17:40
    PierreD Savard
    0

    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

  • PierreD Savard 183 posts 290 karma points
    Feb 10, 2017 @ 00:44
    PierreD Savard
    0

    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 enter image description here

    Order confirmation example: enter image description here

    But nothing... Customer never receive mail. The computer can send email I test it with telnet. Web condig are set like this:

      <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="[email protected]">
        <network host="10.0.10.2"  />
      </smtp>
    </mailSettings>
    

    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.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 10, 2017 @ 16:58
    Rusty Swayne
    0

    Did you hit the "Create" button and verify the view was written to /Views/Merchello/Notifications/ ?

  • PierreD Savard 183 posts 290 karma points
    Feb 10, 2017 @ 18:12
    PierreD Savard
    0

    Yes an, for now i just add Test in the default view created.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 13, 2017 @ 16:11
    Rusty Swayne
    0

    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);
                }
            }
        }
    
  • PierreD Savard 183 posts 290 karma points
    Feb 13, 2017 @ 18:31
    PierreD Savard
    0

    No, never receive OrderConfirmation...

    Where to you put this code?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 13, 2017 @ 23:01
    Rusty Swayne
    0

    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.

  • PierreD Savard 183 posts 290 karma points
    Feb 14, 2017 @ 16:21
    PierreD Savard
    0

    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.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 14, 2017 @ 16:43
    Rusty Swayne
    0

    Hey Pierre - can you log the issue you had with your delete and give me some steps to follow ...

    http://issues.merchello.com

  • PierreD Savard 183 posts 290 karma points
    Feb 14, 2017 @ 16:46
    PierreD Savard
    0

    I will do.

    Did you create a confirmation razor template for FastTrack that display order information like the ftReceipt?

  • krzakivan 27 posts 93 karma points
    Feb 17, 2017 @ 13:45
    krzakivan
    0

    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 .

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 17, 2017 @ 16:26
    Rusty Swayne
    0

    @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 =)

    @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 
    
  • PierreD Savard 183 posts 290 karma points
    Feb 20, 2017 @ 20:59
    PierreD Savard
    0

    Thanks Rusty. I will start with that...

    Do you know where I can change the section on html email template?

  • krzakivan 27 posts 93 karma points
    Feb 22, 2017 @ 13:30
    krzakivan
    0

    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

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 22, 2017 @ 16:36
    Rusty Swayne
    0

    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?

  • krzakivan 27 posts 93 karma points
    Feb 22, 2017 @ 20:21
    krzakivan
    0

    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

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 22, 2017 @ 20:41
    Rusty Swayne
    0

    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 ...

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 22, 2017 @ 22:26
    Rusty Swayne
    0

    I asked the question on Twitter and got a response that, thankfully reeled things back in a bit.

    https://twitter.com/JamesMSouth/status/834526085064699904

  • krzakivan 27 posts 93 karma points
    Feb 25, 2017 @ 18:08
    krzakivan
    0

    Hi Rusty ,
    That seem to be good idea. But I don't know where to change it. Can you help me navigate ?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Feb 27, 2017 @ 16:38
  • krzakivan 27 posts 93 karma points
    Mar 05, 2017 @ 19:02
    krzakivan
    0

    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 ?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 06, 2017 @ 16:45
    Rusty Swayne
    0

    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?

    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;
        }
    
  • krzakivan 27 posts 93 karma points
    Mar 06, 2017 @ 18:48
    krzakivan
    0

    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.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 06, 2017 @ 19:03
    Rusty Swayne
    0

    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.

  • krzakivan 27 posts 93 karma points
    Mar 06, 2017 @ 19:53
    krzakivan
    0

    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 ?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 07, 2017 @ 16:46
    Rusty Swayne
    0

    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.

     namespace MyApp.Startup 
     { 
       ....
     }
    
Please Sign in or register to post replies

Write your reply to:

Draft