_Shipping::PreviewShipments Method [C++]

Use this method to create shipment preview information.

Definition

[C++]

HRESULT _Shipping::PreviewShipments(VARIANT*orderform,
  VARIANT*context,
  VARIANT*ShipmentDistinguishers,
  VARIANT*ShippingPreview);

[Visual Basic]

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

Parameters

  • orderform[C++]
    [in] A pointer to a VARIANT containing the OrderForm dictionary for which to calculate shipping cost previews.
  • orderform[Visual Basic]
    The OrderForm object for which to calculate shipping cost previews.
  • context[C++]
    [in] A pointer to a VARIANT containing the Context dictionary to use to run the shipping components.
  • context[Visual Basic]
    The Context dictionary to use to run the shipping components.
  • ShipmentDistinguishers[C++]
    [in] A pointer to a VARIANT containing a SIMPLEARRAY of strings containing the line item attributes (keys) to use to split the order into shipments.
  • ShipmentDistinguishers[Visual Basic]
    An array of strings containing the line item attributes (keys) to use to split the order into shipments.
  • ShippingPreview [C++]
    [out, retval] A pointer to a VARIANT used to return a Simplelist of dictionaries, one for each shipment, which in turn contain a Simplelist of dictionaries containing the shipping cost previews, one for each shipping method.

Return Values

[C++] This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.

[Visual Basic] 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

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT 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, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] 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

[C++]

The ShippingPreview parameter points to valid data only if the method completes successfully.

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.

[Visual Basic]

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

[Visual Basic]Shipping Object

[C++]Shipping Object

ShippingDiscountAdjust

ShippingManagerCache

[Visual Basic]ShippingMethodManager Object

[C++]ShippingMethodManager Object

ShippingMethodRouter

StepwiseShipping

Copyright © 2005 Microsoft Corporation.
All rights reserved.