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?
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.
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?
Solution I used to get the customer data (properties) was as followed:
order.Properties.Where(x => x.Alias == "firstName").Select(x => x.Value).FirstOrDefault()
Glad you found the solution. You can also do order.Properties["yourPropertyAlias"]
Kind regards
Anders
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.
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
Then it's all good :)
You are right, thanks. I was using order.PaymentInformation.CountryId (doh)...
is working on a reply...