Udostępnij za pośrednictwem


Multiple OrderForms in CS 2006

Quick post to expound on the multiple OrderForm functionality present in the Order Capture system in Commerce Server 2006.

 

An OrderForm can be thought of as a placeholder for a bunch of products / line items and associated data such as payments etc. The OrderGroup class (which is a base class for the Basket, OrderTemplate and PurchaseOrder classes) contains the OrderForms property of type OrderFormCollection which can store multiple OrderForms belonging to a particular OrderGroup.

 

This can be useful if you wish you differentiate a group of LineItems in an OrderGroup from another group of LineItems, for e.g. depending on which Vendor will be shipping those items or say depending on the method of Payment chosen. Thus you could have a Basket containing 3 LineItems A, B and C in 2 OrderForms OF1 and OF2 such that OF1 contains {A, B} and OF2 contains {C}. One important thing to be aware of when considering multiple OrderForm scenarios is that the pipeline execution is done at the level of the OrderForm. Thus when you invoke Basket.RunPipeline(PipelineInfo) the pipeline will internally be executed for each OrderForm separately. This API will first convert all the OF1 data into the legacy dictionary format (using the OrderPipelineMappings.xml file – see the “Orders Pipeline Adapters” for more information on this in the docs), pass this in to the pipeline being executed and then convert back all the data to the new strongly typed object model. Then it would repeat this process for OF2. As a result there will be some performance implications to using multiple OrderForms which you should be aware of.

 

Once you understand the way the pipeline execution is done on the OrderForm level, other things in the object model will also start making sense. For e.g. the reason that collections such as Payments, PromoCodes, Shipments etc. are at the OrderForm level is because of this very constraint. Since pipelines will execute for each OrderForm, the resultant Shipments, Payments etc. will apply only to that OrderForm.

 

In a way, you can think of multiple OrderForms as the ability to have smaller orders inside the context of a single parent PurchaseOrder being placed for a user. It’s the mini-me of Orders.

Comments

  • Anonymous
    January 13, 2006
    Hi Nihit,

    Thanks for the explanation, please keep the tips coming.

    Martyn