To access campaign and promotion definitions, use methods getCampaigns(), getCampaign(String), getPromotions() and getPromotion(String).
To display active or upcoming promotions in the storefront, e.g. on product pages, various methods are provided. getActivePromotions() returns a PromotionPlan with all enabled promotions scheduled for now. getActiveCustomerPromotions() returns a PromotionPlan with all enabled promotions scheduled for now and applicable for the session currency, current customer and active source code. getUpcomingPromotions(Number) returns a PromotionPlan with all promotions that are enabled, not scheduled for now, but scheduled for any time between now and now + previewTime(hours).
Applying promotions to line item containers is a 3-step process, and
PromotionMgr provides methods supporting each of these steps.
Convenience methods can be used that execute all three steps at once,
or the steps can be executed individually if you need to customize
the output of the steps due to specific business rules.
- Step 1 - calculate active customer promotions: Determine the active promotions for the session currency, current customer, source code and redeemed coupons.
- Step 2 - calculate applicable discounts: Based on the active promotions determined in step 1, applicable discounts are calculated.
- Step 3 - apply discounts: applicable discounts are applied to a line item container by creating price adjustment line items.
The simpliest way to execute steps 1-3 is to use method applyDiscounts(LineItemCtnr). The method identifies all active customer promotions, calculates and applies applicable discounts.
Due to specific business rules it might be necessary to manipulate the set of applicable discounts calculated by the promotion engine before applying them to the line item container. To implement such a scenario, you want to use method getDiscounts(LineItemCtnr), which identifies all active customer promotions, and calculates and returns applicable discounts in an instance of DiscountPlan. The discount plan contains a description for all applicable discounts for the specified line item container, and you can remove discounts from it if necessary. The customized discount plan can then be passed on for application by using method applyDiscounts(DiscountPlan).
Due to specific business rules it might be necessary to manipulate the
set of active customer promotions before calculating applicable discounts
from it. For example, you might want to add promotions to the
plan or remove promotions from it.
You want to use method getActiveCustomerPromotions(), which
identifies all active customer promotions and returns an instance of
PromotionPlan. You can add promotions to the promotion plan
or remove promotions from the plan. The customized promotion plan can then be
passed on to calculate applicable discounts by using method
getDiscounts(LineItemCtnr, PromotionPlan).
The active promotions are returned in an instance of PromotionPlan. The promotion plan contains all promotions assigned to any customer group of the current customer, the current source code, or coupons in the current session basket.
The active promotions are returned in an instance of PromotionPlan.
The active promotions are returned in an instance of PromotionPlan.
The active promotions are returned in an instance of PromotionPlan.
The parameter previewTime specifies for how many hours promotions should be previewed.
As a result of this method, the specified line item container contains price adjustments and/or bonus product line items for all applicable discounts. The method also removes price adjustment and/or bonus product line items from the line item container if the related to promotions/discounts are no longer applicable.
As a result of this method, the specified line item container contains price adjustments and/or bonus product line items for all discounts contained in the specified discount plan. The method also removes price adjustment and/or bonus product line items from the line item container if the specified discount plan does not contain the related discount.
Note that the method does not evaluate if the discounts in the specified discount plan are applicable nor that the promotions related to these discounts are active.
The active promotions are returned in an instance of PromotionPlan. The promotion plan contains all promotions assigned to any customer group of the current customer, the current source code, or coupons in the current session basket.
The passed campaign and dates must not be null or an exception is thrown. It is valid for the from and to dates to be in the past. If an invalid time range is specified (i.e. from is after to), the returned PromotionPlan will be empty.
The active promotions are returned in an instance of PromotionPlan.
This method considers only the enabled flags and time conditions of the promotion and campaign. It does not consider whether the current customer satisfies the qualifiers of the promotion (customer group, source code, or coupon).
The passed campaign and dates must not be null or an exception is thrown. It is valid for the from and/or to dates to be in the past. If an invalid time range is specified (i.e. from is after to), the returned PromotionPlan will be empty.
This method identifies all active promotions assigned to the customer groups of the current customer, the active source code and any coupon contained in the specified line item container, and calculates applicable discounts from these promotions.
The applicable discounts are contained in the returned instance of DiscountPlan.
This method calculates applicable discounts from the promotions in the specified promotion plan. Note that any promotion in the promotion plan that is inactive, or not applicable for the current customer or source code, is being ignored.
The applicable discounts are contained in the returned instance of DiscountPlan.
The parameter previewTime specifies for how many hours promotions should be previewed.
The upcoming promotions are returned in an instance of PromotionPlan and might not necessarily be applicable for the current customer or source code.
The parameter previewTime specifies for how many hours promotions should be previewed.