Copied to clipboard

Flag this post as spam?

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


  • Cory Colt 34 posts 127 karma points
    Mar 13, 2017 @ 16:24
    Cory Colt
    0

    Order Shipped Email Notification Not Sending

    I am running the latest version of Umbraco (7.5.11) and the latest version of Merchello (2.5.0). I'm trying to get the Order Shipped email to send once I mark the order's shipment status as "Shipped" (see screenshot below).

    shipment status

    As of right now, only the Order Confirmation is being emailed and seems to be working correctly, so I know the SMTP server is setup and working correctly.

    Do I need to do anything specific or manually to get the Order Shipped email to send? I have it setup as message (same as the order confirmation) in the Notification area of Merchello shown below.

    enter image description here

    enter image description here

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 13, 2017 @ 22:42
    Rusty Swayne
    0

    Hey Cory,

    You need to add an event handler to trigger that notification:

    Take a look at https://our.umbraco.org/projects/collaboration/merchello/merchello/84478-orderconfirmation-general-trigger#comment-84478 ...

  • Cory Colt 34 posts 127 karma points
    Mar 16, 2017 @ 16:08
    Cory Colt
    0

    Rusty,

    I really appreciate your reply and trying to help get this resolved. I have followed your post from the link you provided above, however, the Order Fulfilled notification is still not sending. Based on your post, I created 4 new files in my root directory: IOrderFulfilledNotifyModel, OrderFulfilledNotifyModel, OrderFulfilledTrigger, and RazorOrderFulfilledNotifyMonitor

    enter image description here

    When I create the RazorOrderFulfilledNotifyMonitor I'm not sure where you're getting the GUID from in the MonitorFor attribute, so I created a new GUID:

    [MonitorFor("19993C19-B4D7-4EBC-B2DE-A1A6EEFAE43F", typeof(OrderFulfilledTrigger), "Order FulFilled (Razor)", true)]
    public class RazorOrderFulfilledNotifyMonitor : RazorMonitorBase<IOrderFulfilledNotifyModel>
    {
        public RazorOrderFulfilledNotifyMonitor(INotificationContext notificationContext) : base(notificationContext)
        {
    
        }
    }
    

    What am I missing? This has been very frustrating to get this notification working and I'm dead in the water until it is working correctly. Just to be clear, I'm assuming this is supposed to be triggered in the back office once I capture the funds and mark the order as fulfilled and select "shipped" from the dropdown.

    Any help would be greatly appreciated!

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 16, 2017 @ 16:39
    Rusty Swayne
    1

    Hey Cory - the GUID should be a new Guid.

    I think the only thing you are stumbling on is you are assuming this is an "event" ... which it is not.

    The system is based on the IObservable<T> - which allows classes (in this case monitors) to subscribe to another class (the trigger). Then, when the trigger is executed, it notifies all of the classes that have subscribed to it that something has happened.

    So you need to execute your trigger with:

      Notification.Trigger("[TriggerAlias]", [model], [recipients-array]);
    

    This pattern is a bit more versatile than a strict event based system as in some cases you just want to trigger notifications in a method directly.

    However, in your case you probably want to trigger the notification in an event handler ... like OrderService.StatusChanged?

  • Cory Colt 34 posts 127 karma points
    Mar 20, 2017 @ 20:45
    Cory Colt
    1

    Rusty,

    Ok, so I believe I know what the issue is and it seems to be a bug would be my guess. These are the steps to reproduce:

    1. In the back-office, go to Merchello > Sales > Choose an 'unfulfilled' order.
    2. Click the 'capture funds' button (assuming this is a cash payment), and process the payment so there is a zero balance for this order.
    3. Now that the funds have been captured, click the "Fulfill" button and mark the order as "Shipped" from the dropdown menu.

    Following these steps results in the Order Shipped notification not sending any email. However, if I then navigate to the "Shipments" tab and choose "Edit Shipment" under the Actions dropdown, make sure the "Shipment Status" is still set to Shipped (which it already will be by following the steps above) and click "Save Shipment" THEN the Order Shipped email gets sent!

    Is there no way to have this Order Shipped notification happen when you first choose "Shipped" when you're marking the order as fulfilled?

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 14:37
    Chaz Klein
    0

    Hey Cory,

    I ran into this issue when our client said they wanted to have that automated email send when they mark an order shipped; so they didn't have to manually send out an email every time they update it.

    I have stalled for a bit on it but now I really need to get this working. Did you ever figure this out completely, or did you have to do the work around and actually go into shipments afterwards and hit save again?

    Either way; I'd love to know what you even did and the code/files you needed to create in order to even get to that final step you described. Could you possibly post your solution or I can reach out to you via email, twitter, etc. and talk further?

    I would greatly appreciate any knowledge you might have towards this issue because it has been causing great frustration and taking a lot longer than something so simple should.

    Thanks! - Chaz

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 16:59
    Cory Colt
    2

    Chaz,

    I'm sorry to hear you're experiencing the same issue I was! I can definitely empathize with how aggravating this has been to get something to work that you'd think should work out of the box. I didn't have time to get this working properly unfortunately, but the workaround of having to resave the order like I described in my previous post is what I do at this point until I have some more time to fix it so it will send the email when you originally mark the order as shipped.

    You might be missing something in your UmbracoEventHandler.cs located in your AppCode folder. If you don't have this file then just created it in your AppCode folder and copy and paste this code:

    /// <summary>
    /// Registers Umbraco event handlers.
    /// </summary>
    public class UmbracoEventHandler : IApplicationEventHandler
    {
        /// <summary>
        /// Handles Umbraco Initialized Event.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The <see cref="UmbracoApplicationBase"/>.
        /// </param>
        /// <param name="applicationContext">
        /// Umbraco <see cref="ApplicationContext"/>.
        /// </param>
        public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
        }
    
        /// <summary>
        /// Handles Umbraco Starting.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The <see cref="UmbracoApplicationBase"/>.
        /// </param>
        /// <param name="applicationContext">
        /// Umbraco <see cref="ApplicationContext"/>.
        /// </param>
        public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            OrderService.StatusChanged += OrderServiceStatusChanged;
            ShipmentService.StatusChanged += ShipmentServiceStatusChanged;
        }
    
        private void OrderServiceStatusChanged(IOrderService sender, StatusChangeEventArgs<IOrder> e)
        {
            var validKeys = new[]
            {
                Merchello.Core.Constants.OrderStatus.Fulfilled
            };
    
            foreach (var order in e.StatusChangedEntities)
            {
                if (!validKeys.Contains(order.OrderStatus.Key)) continue;
    
                LogHelper.Info<UmbracoEventHandler>(string.Format("Raising notification trigger for order no. {0}", order.OrderNumber));
    
                Notification.Trigger("OrderConfirmation", order, Merchello.Core.Observation.Topic.Notifications);
            }
        }
    
        /// <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[]
            {
                Merchello.Core.Constants.ShipmentStatus.Delivered,
                Merchello.Core.Constants.ShipmentStatus.Shipped
            };
    
            foreach (var shipment in e.StatusChangedEntities)
            {
                if (!validKeys.Contains(shipment.ShipmentStatus.Key)) continue;
    
                LogHelper.Info<UmbracoEventHandler>(string.Format("Raising notification trigger for shipment no. {0}", shipment.ShipmentNumber));
    
                Notification.Trigger("OrderShipped", shipment, new[] { shipment.Email }, Merchello.Core.Observation.Topic.Notifications);
            }
        }
    
        /// <summary>
        /// Handles Umbraco Started.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The <see cref="UmbracoApplicationBase"/>.
        /// </param>
        /// <param name="applicationContext">
        /// Umbraco <see cref="ApplicationContext"/>.
        /// </param>
        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
        }
    

    Once you have this file in your App_Code directory then it will fire off the order shipped email assuming you have the email configured through your back office. Let me know if this works for you or if you're still stuck and I'll do what I can to help you get this resolved.

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 17:10
    Chaz Klein
    0

    Hey Cory,

    Thank you for your quick response. I have been plugging away at this and trying to create all the necessary .cs files and I had the UmbracoEventHandler.cs file already but just took the one you just posted.

    I haven't been able to test this because my issue is that there are soooo many references in these files that are missing assembly references etc.

    Things like INotifyModel, referencing Merchello.Core things, IOrder, [MonitorFor, INotificationContext etc. These are all missing assembly references etc. What do I need to reference or include in my project to grab these from Merchello's core? Once I have all those references worked out then I should be able to go ahead and test it.

    Thank you so much; your response's are greatly appreciated! - Chaz

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 17:13
    Cory Colt
    1

    This is what I have at the top of the UmbracoEventHandler.cs file:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Umbraco.Core;
    using Merchello.Core.Events;
    using Merchello.Core.Models;
    using Merchello.Core.Services;
    using Umbraco.Core.Logging;
    using Merchello.Core;
    

    By adding these does it fix your missing references error? Also, you're talking about errors specifically in this file, is that correct?

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 17:14
    Chaz Klein
    0

    Here are some screenshots so you can just get an idea of what I am dealing with. enter image description here

    enter image description here

    enter image description here

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 17:18
    Cory Colt
    1

    I'm using Umbraco v7.5.11, what version are you on?

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 17:24
    Chaz Klein
    0

    Yep same exact version. 7.5.11 and Merchello 2.5.0.

    For those 4 files that you created, along with the UmbracoEventHandler.cs file, what do you have as the namespaces and "using" references? That's the one thing I have not seen on any of these files.

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 17:29
    Chaz Klein
    0

    Also, I added the "using" references you had posted above for the UmbracoEventHandler.cs file and both "Merchello.Core.Events" and "Merchello.Core.Services" are both saying they don't exist in the namespace.

    So I am assuming having the correct namespaces for all of these files would help resolve this. Could you let me know the namespaces you have for this file plus the 4 you created?

    Thanks, - Chaz

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 17:35
    Cory Colt
    1

    Ok, so we're on the same versions of both Umbraco and Merchello, so that's good. Honestly, I got rid of all of the files I created except for the UmbracoEventHandler.cs and it works just great (still having to re-save the order for it to fire the order shipped notification though).

    I would try and remove the other files, the IOrderFulfilledNotifyModel.cs, OrderFulfilledNotifyModel.cs, OrderFulfilledTrigger.cs, and RazorOrderFulfilledNotifyMonitor.cs. Then all you should have is just the UmbracoEventHandler.cs file to deal with.

    Next, just make sure in your Umbraco back office that you have configured your Order Shipped email. enter image description here and the details view: enter image description here

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 17:38
    Cory Colt
    1

    Also the "using" statements go above the namespace declaration, in your screenshot you have them underneath

    namespace Merchello.FastTrack.Ui
    {
        ....
    }
    

    It should be:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Umbraco.Core;
    using Merchello.Core.Events;
    using Merchello.Core.Models;
    using Merchello.Core.Services;
    using Umbraco.Core.Logging;
    using Merchello.Core;
    
    namespace Merchello.FastTrack.Ui
    {
        ....
    }
    
  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 17:51
    Chaz Klein
    0

    Thank you for your responses Cory.

    Alright, I have deleted those other 4 files and am just trying to get UmbracoEventHandler.cs to work correctly.

    I have it structured just like you have above but as you can see in the screenshots I took below; I am getting quite a bit of errors that are saying the type or namespaces do not exist in the namespace Merchello.Core (Guessing I am missing assembly references).

    If I can just get these figured out then I should be good. I am wondering if it's .dll file I am missing or what? Sorry to keep this going; just at a loss right now.

    Here are the screenshots. enter image description here

    enter image description here

    enter image description here

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 17:56
    Cory Colt
    1

    Can you show me what your solution looks like. The UmbracoEventHandler.cs should be located in the App_Code directory.

    I don't think you're missing a reference, I think the namespace you're using may be messing you up (Merchello.FastTrack.Ui). Below is what my solution looks like:

    enter image description here

    My namespace for my UmbracoEventHanlder.cs file is:

    namespace YourAppName.App_Code
    {
        ....
    }
    

    where "YourAppName" is replaced by whatever you're calling your application.

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 18:25
    Chaz Klein
    0

    Thanks for your help...

    Still having issues. Changed the location of it and also changed the namespace to be referenced from my project name etc.

    I can't even call Merchello in using or in the code, says that namespace or type could not be found... I must be missing some kind of reference or DLL right?

    enter image description here

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 19:03
    Cory Colt
    1

    Well this is interesting man. Has this Umbraco solution ever worked for you or have you always had reference issues like this? When I started this Umbraco site I've been working on I started with a blank solution and them used NuGet to install Umbraco. Once it was installed I rebuilt the solution. What process did you use to get Umbraco installed?

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 19:29
    Chaz Klein
    1

    After some tinkering and figuring out some stuff; I deleted the file and re-added it and then cleaned and rebuilt and the references were all working now! Thank you so much! I actually just did the steps you listed above with having to go into the shipment field and hitting save after adding it in and it worked!

    Thank you so much for your time; I appreciate your time greatly and you have helped me a bunch!

    Thanks, - Chaz

  • Cory Colt 34 posts 127 karma points
    May 16, 2017 @ 19:46
    Cory Colt
    1

    Nice! I'm glad you got it working! I'm still a little confused as to why there is even a manual process for this. It seems pretty standard that you'd want to send some emails depending on certain criteria surrounding an order, such as:

    1. Order Received
    2. Order Shipped
    3. Order Canceled
    4. Order Refunded
    5. Back Ordered
    6. Etc...

    I hope they fix this on a very near future release. Best of luck wrapping up your development efforts!

  • Chaz Klein 17 posts 88 karma points
    May 16, 2017 @ 20:10
    Chaz Klein
    0

    Yeah; I am not sure as to why those wouldn't be baked in if the order confirmation one was baked in. Seems like an easy update to add the other hooks; hopefully comes soon! I have overcome many obstacles with doing custom things with Merchello but have come out a more versed developer afterwards, hah!

    Thanks again! Cheers

  • Naveed Ali 150 posts 405 karma points
    Jun 03, 2020 @ 15:24
    Naveed Ali
    0

    would just like to say thank you this worked for me. I finally have order shipped emails going through now

Please Sign in or register to post replies

Write your reply to:

Draft