Share via


ReservePromoCodes

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

Use this component to validate and reserve promotion codes.

Intended use: Order Processing pipeline, Order Adjust Price stage.

Values Read

The ReservePromoCodes component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

promo_user_identifty

OrderForm

An optional string containing an alternate identifier for the current user. For example, this could be a membership number or e-mail address. This is used only for Restricted promotions. A match of either the primary user_id or promo_user_identity with the target user of the promotion code will enable the promotion.

BasketOrderGroupID

OrderForm

A string containing the GUID that is the ID of the OrderGroup. This is used when writing entries into the mktg_promocode_history table.

promo_code_info

OrderForm

A Simplelist of Dictionaries that correspond to PromoCodeRecordCollection. The information in each entry is trusted by the ReservePromoCodes component for the amount of time specified by the i_PromoCodeRenewReservationAfter_Minutes resource property setting. After that interval has elapsed, a new lookup on the promotion code is performed and the entry is rebuilt with fresh information.

promo_codes

OrderForm

A Simplelist of strings containing the promotion codes entered by the user that correspond to PromoCodeStringCollection.

user_id

OrderForm

An optional string containing the primary user identifier for the current user. This is always used for restricted promotion codes, and might be used for private promotion codes.

CacheManager

Context

A CacheManager Object that is used for retrieving the cached set of discounts eligible for application.

CommerceResources

Context

The CommerceResourceCollection that contains all of the resources for the site.

Values Written

The ReservePromoCodes component writes the following values to the indicated dictionaries.

Key

Dictionary

Description

promo_code_info

OrderForm

A Simplelist of Dictionaries that correspond to PromoCodeRecordCollection. On output, there is exactly one entry in this list for each promotion code string in the promo_codes list. The information in each entry is trusted by the ReservePromoCodes component for the amount of time specified by the i_PromoCodeRenewReservationAfter_Minutes resource property setting. After that interval has elapsed, a new lookup on the promotion code is performed and the entry is rebuilt with fresh information.

_discounts

OrderForm

A ContentList Object containing the discounts that are passed to the OrderDiscount (PCR) pipeline component. Discounts in the ContentList Object whose promotion requirements are not met are filtered out of the list by setting their Score property to zero.

Remarks

The ReservePromoCodes pipeline component typically runs in the Basket pipeline just before the OrderDiscount (PCR) pipeline component in the Order Adjust Price stage. The ReservePromoCodes pipeline component validates and reserves promotion codes. All promotion codes must be validated, but reservations are only required for limited promotion codes where the number of codes that have not yet been redeemed already has dropped below a configured threshold. Validation depends on the type of promotion code.

A public, unlimited promotion code can usually be validated by a fast lookup in the Discount cache, which is a ContentList Object. Public promotion codes available for a given promotion code definition that has a limit, and private or restricted promotion codes require validation against the database. The validation for public, limited promotion codes verifies that there are promotion codes available. If the number of limited promotion codes drops below the threshold configured in the ReservationRequiredThreshold property of the marketing resource, a reservation is required. If a reservation is granted, the promo_code_info property Reserved is set to True.

For restricted promotion codes, the profile's user_id or the Basket's promo_user_identity must match a value in the u_pc_target_user column of the mktg_promocode table for the promotion code.

For private promotion codes, the promotion code must be valid, and, if a user was specified when the promotion code was defined, the profile's user_id or the Basket's promo_user_identity must match the u_pc_target_user column of the mktg_promocode table for the promotion code.

See Also

Other Resources

What Are Promotion Codes?

Pipeline Component Reference