Order addresses

Order addresses are useful when managing address data retrieved from Customer Management and Order Management, since these use different models for storing data, where one uses Meta Data Plus and the other Business Foundation.

AddressEditModule.ascx - (CMSSite/Templates/Everything/BusinessControls/CheckoutControls/SharedModules), used in checkout by the CheckoutAddressModule.ascx (inside of CheckoutWizardModule.ascx) to create an OrderAddress.

* Metaclass from Meta Data Plus; ** Business Foundation class

How it works

Addresses for an order are stored in the OrderGroup.OrderAddresses property. This property contains anOrderAddressCollection, which containsOrderAddress instances. The OrderAddress Name property is used as an identifier of each address. Shipping and billing addresses are distinguished by having different Name values.

Addresses for a customer are stored in a similar fashion. TheCustomerContact object for a user contains aContactAddresses collection, which containsCustomerAddress instances. The CustomerContact for a user is accessible via CustomerContext.Current.GetContactForUser().TheCustomerAddress class contains similar properties to the OrderAddress class and uses the Name property as identifiers for addresses. The CustomerProfileWrapper (which object for a user (accessible through SecurityContext.Current.CurrentUserProfile),contains two properties,PreferredBillingAddress andPreferredShippingAddress, which contain the name of the appropriate address.

An OrderAddress can be converted to a ContactAddress using StoreHelper.ConvertToCustomerAddress(); the opposite address conversion can be done with theConvertToOrderAddress() method.