_OrderGroup::AddItemsFromTemplate
Use this method to add the line items associated with an on-disk OrderGroup to the current OrderGroup object.
This method iterates across all the OrderForms in the specified template and adds them to the current OrderGroup. If the OrderForms being added already exist, the line items on the template OrderGroup are simply added. When non-existing OrderForms are encountered, the method will add the OrderForm in its entirety to the OrderGroup including OrderForm-level dictionary values.
The OrderGroup keeps a counter of total line items at OrderForm and OrderGroup levels. For the OrderGroup level, it keeps track of the number of line items in all the OrderForms. This value is held under the key "total_lineitems".
Definition
HRESULT _OrderGroup::AddItemsFromTemplate(BSTROrderGroupID);
Parameters
OrderGroupID
[in] A BSTR that specifies the OrderGroup ID for the template.
Return Values
This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.
Error Values
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.
Remarks
Note
- It is the responsibility of the application to implement security. This method does not check that the user ID of the template is the same as the user ID specified in the initialization call.
This method also works on previously submitted orders and baskets, as well as OrderGroups with Template (Saved Order) status.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.