BV Commerce 6 Developer Notes #5 - Promotions

23. February 2011 16:06 by mmcconnell1618

BV Commerce 6 includes a completely revamped promotions engine. The previous version used a selection of pre-built sales and offers that limited what merchants could do in many ways. Because any price adjustments can be complicated it was also difficult to figure out exactly how a price was derived using the old system.

Promotions are now rule-based allowing merchants to mix and match qualifications and actions into powerful sales and offers. Like older versions promotions are grouped into two main types; sales and offers. A sale is a promotion that can apply to individual products as they are viewed on the store. An offer is a promotion that only applies to a cart/order.

Promotions in the Admin

From the Marketing»Promotions screen in the admin you can create custom sales and offers by combing your set of rules and actions or you can select from pre-defined promotions for common scenarios like a Storewide Sale or Free Shipping on specific items.

The main screen also displays the current status of promotions. Disabled promotions are hidden by default and when you create a new promotion it is marked is disabled for safety. This prevents it from accidently applying to items on the store while you’re working on it. You can use the Show Disabled Items checkbox when viewing the list to see any items you’ve created but haven’t completed yet. You can also search for the name of your promotion.

Promotions List

If a promotion is enabled, its status is evaluated based on the current date and time. All times are stored in Universal Time in the database to ensure that offers apply based on the store time zone only. Promotions are shown in the admin as Active, Expired or Upcoming. When the store evaluates promotions it only pulls the Active promotions from the database to reduce the processing require to price items.

Editing Promotions

When you initially create a sale or offer its Mode is set once and cannot change. If you edit a sale you will see a different set of qualifications and actions than you would if you edit an offer.

In the editor you add qualifications first. These are inclusive. Every rule must be valid or the promotion won’t apply. Some rules allow multiple selections. In this case the selections may be any or all based depending on the qualification settings. For example, the Product Category qualifier allows you to select many categories. It will apply to any product that is assigned to at least one of the categories in the list.

Editing Promotions

Qualifiers also have a Relative Processing Cost which is a measure of how much work is involved in checking the rule. Checking a ProductId on a product is a very low cost operation. We already have the product and it’s easy to check the ID. Checking a Product Category selection is a very costly operation because we need to make a database call to load up all categories for each product checked for the promotion. For this reason promotion qualifiers are sorted from lowest to highest cost before checks. This means that low cost checks might rule out the product before expensive steps are taken.

If you are creating your own qualifiers be aware that qualifiers may be called very frequently, especially for sales. Too many high cost operations and too many promotions running at one time can bring a store grinding to a halt if you’re not careful.

Actions are applied in sequence to the product or order. Their effect is cumulative. Adding many actions to a promotion can have strange effects and is not recommended unless you are careful.

Unified Discounting System

The new promotion engine relies on the unified discounting system, which provides much better feedback and reporting on exactly how prices are derived. In the past, prices were adjusted in multiple places and there was no way to track down exactly what happened along the way. One common reporting problem was the prices for sales were adjusted before items arrived in the cart. This meant that reports could not show retail prices and discounts for sales.

The new system uses a list of DiscountDetails on products and line items. Each detail shows the amount applied and a description of what created the discount. User group pricing, volume discounts and promotions all use this list to describe price changes. Any custom code that adjusts prices should use this system too.

Cart with Discount Details

Products are priced when viewed by the BVApplication.PriceProduct() method. This takes into account the current environment like current time and current user when evaluating priced. Calling this one method on any product before display ensures that the correct sales and discounts will be shown to the shopper.

The shopping cart now displays the discounts as part of the line item detail. This makes tracking down pricing origins much easier and allows merchants to add attention getting descriptions of discounts to the cart.

Extending the Discounting System

Although the new discount system is rule based and appears to be very extensible BV recommends that you do not create your own custom qualifiers or actions at this time. We prefer that you contact us with your requirements and see if we can create a built-in generic qualifier or action as needed. There are two reasons for this: a) Promotions can have a big performance impact and we’d rather build them in and test before releasing them on a live store and b) we do not have a plugin model yet for promotions. We’d like the promotions system to live in the wild for a little while before we lock it down to a specific plugin API.

Currently rated 2.8 by 8 people

  • Currently 2.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

bv commerce | BV6

Comments are closed