Copied to clipboard

Flag this post as spam?

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


  • James Meredith 18 posts 91 karma points
    Oct 04, 2016 @ 15:32
    James Meredith
    0

    Order Shipped Notifications not being sent

    Hi,

    I'm developing a site using Umbraco 7.4.3 with Merchello 2.2.0 and the "Order Confirmation" notifications are being sent out fine but the "Order Shipped" aren't and I can't see any error in the logs.

    I was wondering whether I needed to do something to get the notification to trigger?

    Any help would be much appreciated. Cheers,

    James

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Oct 04, 2016 @ 17:34
    Rusty Swayne
    0

    Hey James,

    Add an event handler:

        /// <summary>
        /// Example shipment shipped / delivered notification handler
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The <see cref="StatusChangeEventArgs{IShipment}"/>
        /// </param>
        private void ShipmentServiceStatusChanged(IShipmentService sender, StatusChangeEventArgs<IShipment> e)
        {
            var validKeys = new[]
                            {
                                Core.Constants.DefaultKeys.ShipmentStatus.Delivered,
                                Core.Constants.DefaultKeys.ShipmentStatus.Shipped
                            };
    
            foreach (var shipment in e.StatusChangedEntities)
            {
                if (!validKeys.Contains(shipment.ShipmentStatus.Key)) continue;
    
                LogHelper.Info<UmbracoEventHandler>(string.Format("Raising notification trigger for shippment no. {0}", shipment.ShipmentNumber));
    
                Notification.Trigger("OrderShipped", shipment, Core.Observation.Topic.Notifications);
            }
        }
    
  • Simon Dingley 1458 posts 3409 karma points c-trib
    Nov 07, 2016 @ 12:54
    Simon Dingley
    0

    Hi Rusty,

    I've added this and the event handler gets hit and the notification trigger is sent but no email is sent? The logs says the following as expected:

    2016-11-07 12:48:14,661 [P18824/D2/T13] INFO  MyProject.Infrastructure.UmbracoEventHandler - ::1/umbraco/backoffice/Merchello/ShipmentApi/PutShipment - Raising notification trigger for shippment no. 2
    

    No errors or warnings after this.

    In the UI the email has an attached event of "Order Shipped (Razor)" and email template is an existing template called OrderShipped.cshtml.

    Anything else I've missed?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 07, 2016 @ 16:23
    Rusty Swayne
    0

    Hey Simon,

    Are you passing recipients in your call to the trigger?

  • Simon Dingley 1458 posts 3409 karma points c-trib
    Nov 07, 2016 @ 20:18
    Simon Dingley
    0

    No, because in the UI it is marked to send the notification to the customer so I assumed the trigger would handle that for me. Is that not the case?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Nov 08, 2016 @ 16:08
    Rusty Swayne
    0

    It will as long as you a recipient assigned in the back office.

Please Sign in or register to post replies

Write your reply to:

Draft