Shipping.PreviewShipments

Ee825413.c++_on(en-US,CS.10).gifEe825413.vb_off(en-US,CS.10).gif

Use this method to create shipment preview information.

Definition

Function PreviewShipments(orderform As Variant,context As Variant,ShipmentDistinguishers As Variant) As Variant

Parameters

orderform

The OrderForm object for which to calculate shipping cost previews.

context

The Context dictionary to use to run the shipping components.

ShipmentDistinguishers

An array of strings containing the line item attributes (keys) to use to split the order into shipments.

Return Values

If this method completes successfully, it returns a Simplelist of dictionaries, one for each shipment, which in turn contains a Simplelist of dictionaries containing the shipping cost previews, one for each shipping method.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

The PreviewShipments method creates the shipping cost previews by splitting the order into individual shipments. The mechanism used is the same as the Splitter pipeline component. For more information about how shipment distinguishers are used to split shipments, see Splitter.

The PreviewShipments method returns a SimpleList of dictionaries, one for each shipment. Each shipment dictionary in turn contains a SimpleList of dictionaries each of which contains the shipping cost for using a particular shipping method.

For example code showing how to loop through the preview shipments, see Previewing Shipping Costs.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

' oShip is a Commerce.Shipping object
' dOrder and dContext are Commerce.Dictionary objects
' ADistinguishers is an Array of strings naming line items
' slShipments is a SimpleList of dictionary or orderform objects

slShipments = oShip.PreviewShipments(dOrder, dContext, _
Distinguishers)

See Also

Previewing Shipping Costs

Shipping Object

ShippingDiscountAdjust

ShippingManagerCache

ShippingMethodManager Object

ShippingMethodRouter

StepwiseShipping


All rights reserved.