Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Craig Cronin 304 posts 503 karma points
    Jul 05, 2015 @ 23:51
    Craig Cronin
    0

    uCommerce custom pipleline not working!!!!

    I'm trying to send additional emails when my order has completed. The email would depend on the project code.

    From what I've seen it looks like I need to add a custom task to the Checkout pipeline.

    I've tried to set breakpoints but it doesn't seem do anything.

    Steps: I have checked in uCommerce that its using the checkout pipeline.

    Added

    Added

    And finally

    public class OrderCompletedTask : IPipelineTask

        private readonly CommerceConfigurationProvider _provider;
        private readonly IEmailService _emailService;
        private readonly ICatalogContext _catalogContext;
    
        public OrderCompletedTask(CommerceConfigurationProvider provider,
                                IEmailService emailService,
                                ICatalogContext catalogContext)
        {
            _provider = provider;
            _emailService = emailService;
            _catalogContext = catalogContext;
        }
    
        public PipelineExecutionResult Execute(PurchaseOrder subject)
        {
            var localization = new CustomGlobalization(_provider);
            localization.SetCulture(new CultureInfo(subject.CultureCode));
    
            var queryStringParams = new Dictionary<string, string>();
            queryStringParams.Add("orderguid", subject.OrderGuid.ToString());
            queryStringParams.Add("orderid", subject.OrderId.ToString(CultureInfo.InvariantCulture));
            var emailProfile = _catalogContext.CurrentCatalogGroup.EmailProfile;
            var email = (subject.OrderLines.Any(o => o.Sku.ToLower().Contains("blaa")) ? "[email protected]" : "[email protected]");
    
            _emailService.Send(localization, emailProfile, "Orders", new MailAddress(email), queryStringParams);
    
            return PipelineExecutionResult.Success; 
        }
    }
    

    I have tried taking the line

    Out of the pipeline but it still sends emails at the end of the order. I've restarted the application pool.

Please Sign in or register to post replies

Write your reply to:

Draft