Shipments and Address Structures
The list of shipments produced by the Splitter component contains several nested structures.
The Splitter component in the shipping configuration assigns the list of shipments to the Order.Shipments object. The ShippingMethodRouter component breaks this list down further into a list of shipments
_to
_process
for each individual component run. The list of shipments is a SimpleList object of dictionaries, one for each shipment. The following table shows a sample of the keys in the shipment dictionaries.
Key | Description |
shipping_address_id |
The ID in the Address dictionary of the dictionary containing the address information. |
shipping_method_id |
The shipping method ID,taken from the ShippingConfig database table. |
shipping_method_name |
The name of the shipping method. |
_cy_shipment_total |
The total shipping cost for the items in this shipment. |
ItemIndexes |
A SimpleList object of indexes to the line items in the order. |
The following example code shows how a component might get at the data in the shipments list:
' Assume that dContext is the Context dictionary.
For Each dShipment In dContext.shipments_to_process
' Get the address information by getting the Address dictionary.
Set dAddress = dOrder.Addresses(dShipment.address_id)
' Manipulate the address information here.
' Get the information about each line item in the shipment.
' Items is a SimpleList of dictionaries. ItemIndexes stores
' the indexes of the items in the current shipment.
For Each nIndx In dShipment.ItemIndexes
' Retrieve the dictionary for the given item.
dItem = dOrder.Items(nIndx)
' Manipulate the individual item dictionary here.
Next
Next
Each address dictionary contains the following keys:
Key | Description |
address_name |
Descriptive name for the address. |
address_type |
Address type:
0 Neutral. 1 Shipping. 2 Billing. |
first_name |
First name of the addressee. |
last_name |
Last name of the addressee. |
address_line1 |
First line of the address. |
address_line2 |
Second line of the address. |
city |
City name. |
region_name |
Name of the state, region, or province . |
region_code |
Code for the state, region, or province. |
postal_code |
Postal code. |
country_name |
Country/region name. |
country_code |
Country code. |
tel_number |
Telephone number. |
Notice that although the shipping address is attached to each item, the billing address is attached to the order. The billing
_address
_id
key identifies which address in the Addresses dictionary is the billing address:
' dOrder is an Order dictionary.
' dBillingAddress is a dictionary.
Set dBillingAddress = dOrder.Addresses(dOrder.billing_address_id)
See Also
Setting Up the Pipeline and Cache
Using the Splitter Component to Create Multiple Shipments