Siebel eSales Administration Guide > Shopping Service API > User Action Methods >

OrderTemplate


OrderTemplate copies all the line items from a template to the Shopping Cart. The behavior is similar to AddToCart; the difference is that when you order a template, you add several line items to the Shopping Cart. Each line item will have the quantity specified in the template.

A template is a quote of type Template, so template records are a subset of quote records. Templates have a similar structure to quotes: there is a 1:1 mapping between template and quote business components:

Expected Preconditions Before the Method Can Be Called

OrderTemplate uses field maps defined in the Shopping Service business service user properties to copy field values from Quote Template Item to Quote Item and from Quote Template Item XA to Quote Item XA. The field maps are shown in Table 40 and Table 41.

Table 40. Quote Template Item to Quote Item Field Map
Name
Value
Quote Template Item|Quote Item FieldMap 100
Product Id|Product Id
Quote Template Item|Quote Item FieldMap 101
Quantity Requested|Quantity Requested
Quote Template Item|Quote Item FieldMap 102
Adjusted Reference Price|Adjusted Reference Price
Quote Template Item|Quote Item FieldMap 103
Base Price|Base Price
Quote Template Item|Quote Item FieldMap 104
Unit Price|Unit Price
Quote Template Item|Quote Item FieldMap 105
Product|Product
Quote Template Item|Quote Item FieldMap 106
Product Port Id|Product Port Id
Quote Template Item|Quote Item FieldMap 107
End

Table 41. Quote Template Item XA to Quote Item XA Field Map
Name
Value
Quote Template Item XA|Quote Item XA FieldMap 100
Attribute Id|Attribute Id
Quote Template Item XA|Quote Item XA FieldMap 101
Name|Name
Quote Template Item XA|Quote Item XA FieldMap 102
Display Name|Display Name
Quote Template Item XA|Quote Item XA FieldMap 103
Read Only|Read Only
Quote Template Item XA|Quote Item XA FieldMap 104
Data Type|Data Type
Quote Template Item XA|Quote Item XA FieldMap 105
LOV Type|LOV Type
Quote Template Item XA|Quote Item XA FieldMap 106
Value|Value
Quote Template Item XA|Quote Item XA FieldMap 107
End

The OrderTemplate method has the arguments shown in Table 42.

Table 42. OrderTemplate Arguments
Name
Type
Data Type
Optional
Comments
Template Id
Input
String
Y
Not used, as OrderTemplate is always row-sensitive.
ReturnVal
Output
String
Y
Returns Success or Fail depending on whether AddItem succeeds or not.

Pseudo-Algorithm

  1. Get the Quote Template, Quote Template Item, Quote Template Item XA, Quote, Quote Item, and Quote Item XA business components.
  2. The Quote Template business component is already positioned on the correct record, as the OrderTemplate method is row-sensitive.

  3. Call the AddHeader method to make sure there is a Shopping Cart.
  4. Loop through each record in the Quote Template Item business component and create a corresponding record in the Quote Item business component. Use the field maps to copy fields from Quote Template Item to Quote Item, then copy the child records from Quote Template Item XA to Quote Item XA.
  5. NOTE:  As Quote Item and Quote Template Item have hierarchies, you cannot simply loop through the records in Quote Template Item and copy them to Quote Item. You need to maintain the hierarchical relationship. To do this, you need to copy the parent record before you copy its child records.

    In the Shopping Service implementation, records are first loaded from Quote Template Item and a tree in the memory is generated. The tree is then traversed from the root, so the parent record is copied before the child records.


 Siebel eSales Administration Guide 
 Published: 18 April 2003