Copied to clipboard

Flag this post as spam?

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


  • Chris Eddy 5 posts 75 karma points
    Sep 24, 2017 @ 23:55
    Chris Eddy
    0

    How to access Merchello services from outside of umbraco

    We have a customer front end built with umbraco and merchello and that works fine, but now we are trying to build a custom CRM where sales staff can access merchello customers and orders.

    I set up the project with references to Umbraco.core and Mechello.core and set up the umbraco connection string in the web.config that points to our umbraco database. Everything compiles, but when I try to access MerchelloContext I get a null reference because there is no current context.

    Here is the code bit that is failing...

        var customerService = MerchelloContext.Current.Services.CustomerService;
    
        var customers = customerService.GetPage(1, 20, "LastName").Items.ToList();
    

    From what I have read, this is occurring because the context is not being initiated in the startup of the project.

    So I am wondering what else I need to do other than add references for the umbraco.core and merchello.core to make this work.

    Or is there a different API call that I can make to pull customer information outside or Umbraco.

Please Sign in or register to post replies

Write your reply to:

Draft