_OrderGroup::SaveAsOrder

Ee798681.c++_off(en-US,CS.10).gifEe798681.vb_on(en-US,CS.10).gif

Use this method to save the OrderGroup to the database with an order status.

Definition

HRESULT _OrderGroup::SaveAsOrder(VARIANT*vtOutTrackingNumber,VARIANT*pvtRetVal);

Parameters

vtOutTrackingNumber

[in] A pointer to the VARIANT used to return the tracking number. If specified, this VARIANT will contain the tracking number when the method returns.

pvtRetval

[out, retval] A pointer to a VARIANT used to return the OrderGroupID.

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

The pvtRetVal parameter points to valid data only if the method completed successfully.

This method sets the OrderGroup status to "order" if the current status is Template, Basket, or undefined. (All other states are left alone; this allows orders to be in many states, such as pending approval, rejected, and so on.) You can set the state to any value except basket or template before calling the SaveAsOrder method; this method will not overwrite the state.

If this is the first time the order is saved, a special field will be written that records the order creation date. If an OrderTrackingNumber already exists on the OrderForm (under the key order_number) before the save, a new one will not be generated. This feature allows for ERP-based tracking numbers.

If the OrderGroup was loaded from a template, or from a basket, this method will generate a new OrderGroupID and tracking number, and perform a database insert. If the OrderGroup does not yet exist on disk, this method will generate an OrderGroupID and tracking number and perform a database insert. If the OrderGroup was loaded from any other state, this method will perform a database update.

If you load a basket or template and call the SaveAsOrder method, the basket or template remains unchanged on disk. For this reason,a call to the SaveAsOrder method is typically followed by a call to OrderGroupManager.DeleteOrderGroupFromDisk.

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

See Also

OrderGroup Object

_OrderGroup::SaveAsBasket

_OrderGroup::SaveAsTemplate


All rights reserved.