CSFLoadDiscounts

Use this component with the CacheManager object to load discounts for the Content Selection Framework.

Note

Although the CSFLoadDiscounts component implements two pipeline component interfaces (IPipelineComponent and IPipelineComponentAdmin), it is not a pipeline component, it does not appear in the Pipeline Editor, and cannot be used or configured in the Pipeline Editor.

Configuration Values

You can configure this component in two ways.

  • By using the settings of the caches element of the Web.config file. For more information see caches Element.

  • By using code. The following code sample provides an example of how to configure the component.

    Set dictConfig = CreateObject("Commerce.Dictionary")
    dictConfig.ConnectionString = CONNECTIONSTRING
    dictConfig.DefaultLanguage = "en-US"
    Set oCacheManager = CreateObject("Commerce.CacheManager")
    Set oCacheManager.LoaderConfig("Discounts") = dictConfig
    oCacheManager.LoaderProgId("Discounts") = "Commerce.CSFLoadDiscounts"
    oCacheManager.RefreshInterval("Discounts") = 900
     
    Set dictCache = oCacheManager.GetCache("Discounts")
    

The following table describes the CSFLoadDiscounts configuration values needed to configure this component by using code.

Key

Description

ConnectionString

The connection string for the campaigns database.

LoadDiscountsProcedure

Specifies the name of the stored procedure that the Cache Loader component uses to load the MarketingDiscounts cache. The procedure must exist in the Marketing database, and it must have the same signature as mktg_spRuntimeLoadDiscounts. That procedure must include in its results set all columns found in mktg_spRuntimeLoadDiscounts.

Evaluator

Evaluates marketing expressions.

DefaultLanguage

Specifies the default language of the marketing system.

Values Read

None.

Values Written

None.

Remarks

You can use the CSFLoadDiscounts component with the CacheManager object to load discounts for use later in your application.

When run by the CacheManager object, the CSFLoadDiscounts component uses two pipeline dictionaries (Order and Context) to determine how to run and how to return information to the CacheManager object.

The CSFLoadDiscounts component first opens a connection to the database and gets the list of discounts. The component uses a ContentListFactory object to populate a ContentList object with the data. The component then extracts templates, target groups, and page groups from the retrieved information.

The following table describes the columns in the ContentList object returned by the CSFLoadDiscounts component. Column names appear in alphabetical order.

Column Name

Type

Flags

Description

award_expr

int (CLCOL_I4)

1 (CLCOL_READONLY)

The expression reference that identifies what a user receives if he/she qualifies for the discount.

award_max

int (CLCOL_I4)

1 (CLCOL_READONLY)

The maximum number of awards for the discount.

campaign_id

int (CLCOL_I4)

1 (CLCOL_READONLY)

The unique identifier of the containing campaign.

click_required

Boolean (CLCOL_BOOL)

1 (CLCOL_READONLY)

The flag indicating that a user must click the advertisement associated with this discount to be eligible for the discount.

condition_basis

int (CLCOL_I4)

1 (CLCOL_READONLY)

The type of the discount buy condition.

condition_expr

int (CLCOL_I4)

1 (CLCOL_READONLY)

The expression that is evaluated against each item in the user's basket.

condition_mny_min

Currency (CLCOL_CY)

1 (CLCOL_READONLY)

The minimum price that must exist for this condition to be satisfied.

condition_qty_min

int (CLCOL_I4)

1 (CLCOL_READONLY)

The minimum quantity that must exist for this condition to be satisfied.

date_end

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date and time, in the local time zone, the current CampaignItem is set to end.

date_modified

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date the current CampaignItem object was last modified.

date_start

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date and time, in the local time zone, the current CampaignItem is set to start.

description

String (CLCOL_STRING)

1 (CLCOL_READONLY)

A free-form description (comment) string for the current CampaignItem. This is the basket display string in the marketing default language, or NULL if there is no basket display in the default language. If the value is NULL, the discount will be invalidated.

disjoint

Boolean (CLCOL_BOOL)

1 (CLCOL_READONLY)

The flag indicating whether items used to qualify for the discount (DiscountCondition) can be reused as awards for this discount.

exposure_limit

int (CLCOL_I4)

1 (CLCOL_READONLY)

The exposure limit of the current DisplayableCampaignItem object.

expressions_used_for_display

Boolean (CLCOL_BOOL)

1 (CLCOL_READONLY)

The value indicating if eligibility requirement may be used for targeting this discount in addition to target groups.

height

short (CLCOL_I2)

1 (CLCOL_READONLY)

The Height of the current DisplaySize object.

item_id

int (CLCOL_I4)

1 (CLCOL_READONLY)

The unique identifier of the current CampaignItem object.

limit

int (CLCOL_I4)

1 (CLCOL_READONLY)

The maximum number of times this discount can be applied to a basket.

name

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The name of the current CampaignItem object.

offer_type

int (CLCOL_I4)

1 (CLCOL_READONLY)

The enumeration that determines how the discount offer amount is applied.

offer_value

Currency (CLCOL_CY)

1 (CLCOL_READONLY)

The amount of the discount offer.

order_level

Boolean (CLCOL_BOOL)

1 (CLCOL_READONLY)

A Boolean indicating whether the discount is an order-level discount.

pagegroups

SafeArray (CLCOL_VARIANTARRAY)

1 (CLCOL_READONLY)

The collection of PageGroup objects associated with the current DisplayableCampaignItem instance.

rank

int (CLCOL_I4)

1 (CLCOL_READONLY)

The priority of this discount.

required_exprs

SafeArray (CLCOL_VARIANTARRAY)

1 (CLCOL_READONLY)

A safe array of eligibility requirements expressions ids.

score

real (CLCOL_R4)

6 (CLCOL_PRIVATE | CLCOL_SCORE_COLUMN)

A value read and written by several CSF pipeline components to determine whether an ad needs to be displayed. A higher score means that an ad is more likely to be returned by the CSF pipelines.

size

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The display size name of the current DisplayableCampaignItem instance.

special_offer_type

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The enumeration that determines how the discount offer amount is applied.

target_actions

SafeArray

(CLCOL_VARIANTARRAY)

(( arr[0]=expr0, arr[1]=action0 ) ... ( arr[2N]=exprN, arr[2N+1]=actionN )

1 (CLCOL_READONLY)

A list of expression-action pairs that are loaded per campaign item. This replaces target_groups from previous Commerce Server versions.

template

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The display template name of the current instance.

width

short (CLCOL_I2)

1 (CLCOL_READONLY)

The width of the DisplaySize object.

Abbreviations in the table are enumerated values for the ContentList object.

Note

The disc_id column was present in previous versions of Commerce Server, but it is no longer present.

If necessary, you can add additional custom fields into the ContentListFactory cache by overriding the default query for CSFLoadDiscounts. Overriding the query is an advanced programming technique, and requires that you have detailed knowledge of SQL queries.

See Also

Other Resources

Pipeline Component Reference