Share via


How to Coordinate Components

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Because Commerce Server pipeline components run in a linear manner, certain coordination must exist between the components. Component coordination is very important when multiple components exist in the same stage but only some of the components in the stage are implemented. The components that are implemented relate to the actions of the Web site user. For example, the Payment stage might include one component that implements payment by electronic currency, and another that charges to a credit card. But you only want to run the component that corresponds to the request made by the user. If the user wants to pay by credit card, the payment by electronic currency component should not be run.

The Commerce Server pipeline architecture dictates that components in certain stages must coordinate to allow for such multiple-choice components to exist in the same stage. The components that come with Commerce Server already follow this convention. Special care must be taken when writing your own components to make sure that they follow this convention.

Consider the following when you create new components:

  • If the value that the component is supposed to compute is already set when the pipeline component starts running, the component should immediately exit. For example, if the user chooses to pay by credit card and the credit card component is run before the electronic currency component, the credit card component will set the payment_method key to credit card. Then, when the electronic currency component is run, it should see that the payment_method key has been set and should exit.

  • If a component determines that it cannot or should not perform the task for the stage, it should leave the Dictionary entry for the stage alone. The payment_method key is a frequently used apply Dictionary key in the Payment stage and the component should only continue to run if the correct payment_method key value is set. For example, the user chose to pay by credit card and the credit card component set the payment_method key to credit_card. Then, when the electronic currency component is run it checks to see whether the payment_method key is set to electronic currency, and when it determines that the payment method key is not set to electronic currency, it should not apply the rest of the component by charging the user through electronic currency.

Component coordination is very important in the following stages:

  • Shipping. Component coordination is very important for backward compatible components, but usually is not required when you use the multiple-shipping shipment architecture in Commerce Server. The _cy_shipping_total key must be coordinated. The shipping_method key is the apply key.

  • Handling. The _cy_handling_total key must be coordinated. The shipping_method key is the apply key.

  • Tax. Although this stage should be coordinated, we recommend that you have only one tax component in your pipeline. The _cy_tax_total is the key to coordinate. The country key is the apply key.

  • Payment. The payment_method key is the key to coordinate and the apply key.

See Also

Other Resources

How to Use the Scriptor Component