Share via


OrderGroup.AddItem Method (PIA)

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

This method adds a line-item dictionary to the given OrderForm object (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 object and OrderForm object levels.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Orders
…
Public Function AddItem(dictItem As Object,
  Optional strOrderFormName As Object) As Integer

[C#]

using Microsoft.CommerceServer.Interop.Orders;
using Microsoft.CommerceServer.Interop;       //For IDictionary
…
public int AddItem(IDictionarydictItem,
  objectstrOrderFormName);

Parameters

[Visual Basic .NET]

  • dictItem
    A Dictionary object that contains the line-item information.
  • strOrderFormName
    An Object that specifies the name of the OrderForm object 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 OrderForm objects).

[C#]

  • dictItem
    A Microsoft.CommerceServer.Interop.IDictionary interface to a Dictionary object that contains the line-item information.
  • strOrderFormName
    An object that specifies the name of the OrderForm object 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 OrderForm objects.)

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an Integer that specifies the index at which the item was added.

[C#] This method returns an Integer containing the index at which the item was added.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

Remarks

Ee825526.note(en-US,CS.20).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)

[Visual Basic .NET]

Example

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

Requirements

Namespace: Microsoft.CommerceServer.Interop.Orders

Platforms: Windows 2000, Windows Server 2003

Assembly: Microsoft.CommerceServer.Interop.Orders.Requisition.dll

See Also

OrderGroup Class

OrderGroup.RemoveItem

Copyright © 2005 Microsoft Corporation.
All rights reserved.