Answered by:

Billing address

Question

I'm confused about the addresses in the order system. When you create an order for a user does the billing address stay in the profile system as an address profile (with address type = billing) and then you reference it in the order by using the SetBillingAddress method? or do you add it to the order as an OrderAddress? If it's the latter then how do you distingish it from the shipping addresses in the OrderAddressCollection?

Answers

Typically, the Addresses within the profile system are addresses that users have saved to your system for future use, and they are associated with the address list property of a given user object.

OrderAddresses, on the other hand, are distinct entries in the system associated with specific orders. Even if I use the same address information on two different orders, I should not share OrderAddress entries between those two orders.

All addresses associated with an order are going to be present in the OrderAddressCollection of that order. You distinguish between billing and shipping addresses by looking at the ShippingAddressID of the LineItem or Shipment object, and the BillingAddressID of the Payment or OrderForm object.

To give you a quick breakdown of the class structure:

pre-CS2007

OrderGroup (PurchaseOrders or Baskets)

OrderForms (each OrderForm contains a reference to a billing address in the OrderAddresses collection)

LineItems (each LineItem contains a reference to a shipping address in the OrderAddresses collection)

OrderAddresses

CS2007

OrderGroup (PurchaseOrders or Baskets)

OrderForms

Payments (each Payment contains a reference to a billing address in the OrderAddresses collection)

Shipments (each Shipment contains a reference to the shipping address in the OrderAddresses collection)

LineItems

OrderAddresses

As you can see, the newest version of Commerce Server really allows the developer to do a lot with multiple payments and multiple shipments within a single order.

All replies

Typically, the Addresses within the profile system are addresses that users have saved to your system for future use, and they are associated with the address list property of a given user object.

OrderAddresses, on the other hand, are distinct entries in the system associated with specific orders. Even if I use the same address information on two different orders, I should not share OrderAddress entries between those two orders.

All addresses associated with an order are going to be present in the OrderAddressCollection of that order. You distinguish between billing and shipping addresses by looking at the ShippingAddressID of the LineItem or Shipment object, and the BillingAddressID of the Payment or OrderForm object.

To give you a quick breakdown of the class structure:

pre-CS2007

OrderGroup (PurchaseOrders or Baskets)

OrderForms (each OrderForm contains a reference to a billing address in the OrderAddresses collection)

LineItems (each LineItem contains a reference to a shipping address in the OrderAddresses collection)

OrderAddresses

CS2007

OrderGroup (PurchaseOrders or Baskets)

OrderForms

Payments (each Payment contains a reference to a billing address in the OrderAddresses collection)

Shipments (each Shipment contains a reference to the shipping address in the OrderAddresses collection)

LineItems

OrderAddresses

As you can see, the newest version of Commerce Server really allows the developer to do a lot with multiple payments and multiple shipments within a single order.