Copied to clipboard

Flag this post as spam?

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


  • egeek 40 posts 179 karma points
    May 03, 2014 @ 16:04
    egeek
    0

    Order order (get customer data)

    I'm creating an XML manually when an order is finalized. For that I need to get some order details, which I can't seem to find anywhere.

    What I need is; company name, customer address, customer zip, customer phone, customer email
    delivery company name, delivery customer address, delivery customer zip.

    I can get order.customerId and get the data from Umbraco Membership Provider, but if the users is not created this is of course not possible.

    I can get the name from order.PaymentInformation.FirstName/LastName, but what about delivery name?
    From order.ShipmentInformation I can only get country and price.

    Am I missing something, or do I really need to get an order as XML/JSON, loop through it and extract the data I need?

  • egeek 40 posts 179 karma points
    May 04, 2014 @ 04:07
    egeek
    0

    Solution I used to get the customer data (properties) was as followed:

     order.Properties.Where(x => x.Alias == "firstName").Select(x => x.Value).FirstOrDefault()

  • Anders Burla 2560 posts 8256 karma points
    May 04, 2014 @ 12:38
    Anders Burla
    0

    Glad you found the solution. You can also do order.Properties["yourPropertyAlias"]

    Kind regards
    Anders

  • egeek 40 posts 179 karma points
    May 04, 2014 @ 15:07
    egeek
    0

    Thanks Anders :)

    Are they just as fast?
    Btw, I noticed that the property shipping_country is missing, but in the starter kit, it's possible to choose country in shipping address.

  • Anders Burla 2560 posts 8256 karma points
    May 04, 2014 @ 15:08
    Anders Burla
    0

    Yes - its the same code that runs that you wrote :)

    The shipping country is available at order.ShippingInformation.CountryId (which can be null if not set)

    Kind regards
    Anders

  • egeek 40 posts 179 karma points
    May 04, 2014 @ 15:32
    egeek
    0

    Then it's all good :)
    You are right, thanks. I was using order.PaymentInformation.CountryId (doh)... 

Please Sign in or register to post replies

Write your reply to:

Draft