OrderGroup.AddItem

Ee799887.c++_on(en-US,CS.10).gifEe799887.vb_off(en-US,CS.10).gif

Use this method to add a line item to the specified OrderForm object.

This method adds a line-item dictionary to the given OrderForm (the strOrderFormName parameter). If the strOrderFormName is not supplied, the parameter strOrderFormName defaults to "default"; if "default" does not exist, it is created. This method also increments the aggregated quantity total at the OrderGroup and OrderForm level.

Definition

Function AddItem(dictItem As Object,Optional strOrderFormName As Variant) As Long

Parameters

dictItem

A Dictionary object that contains the line-item information.

strOrderFormName

A Variant that specifies the name of the OrderForm to add the item to. Depending on how a site is structured, you may choose to specify the vendor name of the item as the strOrderFormName. (This will result in items from different vendors being added to different OrderForms).

Return Values

If this method completes successfully, it returns a Long that specifies the index at which the item was added.

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

Ee799887.note(en-US,CS.10).gif Note

  • Each line item that is added should contain a quantity.

  • If you are using the QueryCatalogInfo component in your pipeline, you will also need:

    • product_catalog

    • product_id

    • product_variant_id (if this is a product variant)

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

Example

' dDict is a Dictionary object
' lLineItemIndex is a Long
' sMyOrder is a String
' oOrderGroup is a Commerce.OrderGroup object
lLineItemIndex = oOrderGroup.AddItem(dDict, sMyOrder)

See Also

OrderGroup Object

OrderGroup.RemoveItem


All rights reserved.