Pseudo-Algorithm for OrderTemplate
Get the Quote Template, Quote Template Item, Quote Template Item XA, Quote, Quote Item, and Quote Item XA business components.
The Quote Template business component is already positioned on the correct record, as the OrderTemplate method is row-sensitive.
Call the AddHeader method to make sure there is a Shopping Cart.
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.
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.