This extension enables the management of customer sales promotions.

Key Concepts

  • Promotion: Discount which is automatically applied to a cart or order, when some conditions are met.
  • Product Level Promotions
    • Bundle: Fixed price when buying A, B or C.
    • Buy X get Y free
    • Fixed price for a set of products
    • Multi-buy: Fixed price of many products from a set
    • One to one perfect partner bundle: Two defined products for a fixed price.
    • Percentage discount
    • Perfect partner: Products for two categories for a fixed price.
    • Perfect partner bundle: One product and many additional products from a set for fixed price.
    • Stepped multi-buy: Discount by buying a higher quantity of the same product.
  • Order Level Promotions
    • Free gift with an order over $ X
    • Free voucher with an order $ X
    • Fixed Discount with an order over $ X 
    • Free shipping or faster shipping with an order over $ X
    • Order threshold perfect partner: If you spend more than $ 100, you get any coffee capsules for $ 3 
  • Restrictions
    • Start and end date.
    • User groups: some users can or cannot use this promotion
    • Product: Some products can't be applied to the current promotion. This product could be used with another promotion.
    • Order: The promotion can only be applied to some given orders.
    • Store: The promotion can only be applied in some stores.

Key Features

  • Promotions are inactive by default. They must be activated, when they are completely configured.
  • Each promotion points to URL which describes the promotion
  • Evaluation
    • Active Promotions evaluation: Which promotions are included in the cart?
      • They consume the cart entries.
      • It generates entry or order discounts
      • The promotion with the highest priority is evaluated first
      • A fired message can be shown. For example: "You have received 3 boxes for $33, saving $7".
    • Partial Promotion evaluation: Which promotions could be fired?
      • They don't consume cart entries to allow the extension to calculate other possible promotions
      • It doesn't generate any discount
      • It returns the probability of firing the promotion.
      • A "could be fired" message can be shown. For example: "Add 1 box to get 3 boxes for $33, saving $7".
    • Hybris will automatically create order or entry discounts when the promotion is applied. The type of discount depends on the type of promotion.
  • A cache could be activated to improve the performance of the calculation of the promotions.
    • The results of the evaluation using the cache are persisted after the promotion is applied to an order. Before that point in time, they are stored in the session. When a persisted cart is restored, the promotions must be recalculated.
    • A cluster-aware implementation could be developed.
  • Promotions can be grouped

Workflow

Please use this advise carefully, as I wasn't able to check if this workflow actually works.

  1. The customer adds or removes products to the cart
  2. The cart is recalculated
  3. The method PromotionService.updatePromotions(...) is called.
  4. The result are returned. it includes the fired and the potential promotions, the entries used in the fired or potential promotions and a flag indicated of there were changes since the last evaluation.
  5. If the cart is updated, it must be recalculated and reapplied
  6. At the end of the checkout process the order is created using the cart.
  7. The promotions are applied to the order by calling the PromotionService.transferPromotionsToOrder.
  8. Now the persisted promotions or their results are returned by calling PromotionService.getOrderPromotions(...) and getPromotionResults(...)

The promotions and their results can be removed from the cart by calling PromotionService.cleanupCart(...)

Worth reading

Hybris has posted here a UML diagram with the classes used by this extension:

https://wiki.hybris.com/download/attachments/141793320/04%20-%20hybris%20-%20promotions%20module.pdf?version=1&modificationDate=1261571130000&api=v2

Pitfalls

  • Neither a cart nor an order is aware of promotions.  After any change to the cart or order, you have to recalculate it and then call the method PromotionsService.updatePromotions(...)
  • This extension uses the jalo layer. The PromotionService delegates the calls to the promotion manager.

Based on Hybris Version 5.3

Add comment


Security code
Refresh