Develop > Presentation layer > Customize promotions > Promotion engine customization > Promotion engine components


Promotion engine flow during promotion evaluation

The promotion engine evaluates promotions for customers while they shop on the storefront. The evaluation process has several stages and involves different components of the promotion engine.

The following diagram shows the flow of an invocation of the promotion engine.

First, the PromotionAgendaBuilder, registered with the promotion engine, is called to build an agenda for this invocation. An agenda functions similar to a table that contains a list of promotions to be evaluated, and all of the applicable policies for each promotion.

When the agenda is built, the promotion engine calls the registered PromotionContextFactory to create a promotion context. Next, the promotion engine calls a registered PromotionSequenceBuilder to sort all of the promotions listed in the Agenda to decide the sequence in which to evaluate the promotions. After the sequence is determined, the initialization phase of a call to the promotion engine is finished.

In the next stage, the promotion engine iterates through the sequence built earlier and evaluates the promotions individually. When a promotion is evaluated and deemed applicable, the promotion engine looks up the promotion execution agenda and finds all of the application promotion policies for this promotion. It then initializes the promotion control block (PCB) and tentatively applies the promotion. After the promotion is tentatively applied, the promotion engine applies the applicable promotion policies individually. If a violation is detected, the PCB is rolled back, and the promotion is not applied. If no violation is found after all of the policies have been applied, the PCB is committed. This means that this promotion is now applied to the order. This process continues until all of the promotions in the sequence have been evaluated. Then, a PromotionArgument object is built based on the content of the Promotion Context and returned as the result of this invocation.


Promotion evaluation sequence

To reconcile the order of promotion display with the order of promotion evaluation (that is, product-level promotions before order-level promotions) in stores based on the consumer direct sample store:

  1. Exit from the store.

  2. Edit... WC_EAR /xml/PromotionEngineConfiguration/WCSPromotionEngineConfig.xml

  3. Locate the PromotionExecutionSequenceBuilder element.

  4. Change the value of its impl attribute from com.ibm.commerce.marketing.promotion.runtime. DefaultSequenceBuilder to com.ibm.commerce.marketing.promotion.runtime. StaticSequenceBuilder.

  5. Open the store.