How To

Commonly Used Business Rules

There are many business rules that are commonly used. The table below represents just a few of these commonly used rules.

 

Prerequisites


You should be familiar with the following topic:

 

Commonly Used Business Rules


 

Rule Name Channels Explanation/Uses Rule Code

Remove HTML from Description

General

Often, inventory source data is formatted for display on a website and will contain HTML values to customize the display format of an item's description. Many sites, however, do not accept HTML in description fields. Rather than rewriting description text, you could use a business rule function called STRIPHTML to remove HTML tags formatted as < > and </ >. 

  • STRIPHTML(X) where X is the field that you want to strip HTML from.
     
  • REGEXREPLACE(REGEXREPLACE(STRIPHTML($offerdescription),"&+#[a-zA-Z0-9]+;",""),"&[a-zA-Z0-9]+;","")

    This rule uses the STRIPHTML function to remove complete html tags, but also replaces any HTML character codes with blanks.

Adding Data Values Together

General

When customizing data for feeds many businesses will wish to combine inventory source fields into one data value to send to a site. This can be done using the CONCATENATE business rule function. This will allow you to combine as many as 8 fields or text values together into one combined string.

CONCATENATE(X,Y,Z)  where X, Y and Z represent fields or text strings that you are combining together.


CONCATENATE can combine up to 8 values together. Keep in mind that the CONCATENATE function will not automatically put a space between the elements you are combining together. Therefore, if you want a space, be sure sure to add " " as a value fields or strings that you are combining. For example to combine "Hello" and "there" together, the rule would look like this: 

CONCATENATE("Hello"," ","there")

EVAL

General

"Rules that write rules." Example: Use a lookup list that has brand in the left-hand column, and then the right-hand is basically a business rule to use for that brand. 

Some technical notes: 
* EVAL doesn't know how to call your custom functions, so avoid these in your input text. 
* If your input text has a syntax error, EVAL will "drop" the item from feeds.

EVAL(LOOKUP("The List",$brand))

 

Proper Case Rule

General

Useful when data elements are formatted in all capitalized letters. Submitting fields in all caps isn't permitted on most major sites.

PROPER($itemtitle)

Backup Price Field Rule

General

If your price field is blank, you can use another field to populate a price with an "If Blank" rule.

IFBLANK($$regularprice, $$currentprice)

Brand Filter Rule

General

Use this rule on a channel specific template, in conjunction with a "Brand Exclusion List" Lookup List to filter out specific branded items.

isinlist("Brand Exclusion List",$itembrand)

Format Currency Rule

General

Strip currency symbol from price, limit to 2 decimal places.

FORMATCURRENCY(IFBLANK($itembinprice,$itemretailprice))

Marketplace Price Adjustment Rule

General

Adjusts price that can be applied specifically to a marketplace/destination. This example shows 10% price adjustment.

$itembinprice * 1.10

Convert Weight

General

Convert the Weight from kg to lb.

$itemweight * 2.2

Title Optimization Rule

General

Dynamically build or add content-rich attributes to enhance you title.

JOIN(" ",$itembrand,$itemtitle,$color,$size)

Custom Tracking Rule - Single Provider

Shopping/Feeds

This rule appends a custom tracking parameter name/value pair to the product URL. It determines whether or not the product URL already contains a questionmark and uses an ampersand or questionmark accordingly. A rule for each provider is need with the specific parameter value changed to match the provider for each rule.

CONCATENATE($actionurl,IF(CONTAINS($actionurl,"?"),"&","?"),"parametername=value")

Filter Out of Stock Rule

Shopping/Feeds

Filter out of stock items.

$$instock=0 OR TOLOWER($$instock)="out of stock"

Shipping Rule

Shopping/Feeds

This rule can be used in all CSE templates. It will populate the feed with the shipping price, including the correct format for Google Shopping US, assuming the product level shipping price is stored in the "shippingprice" field of the inventory data source.

IF($shippingprice <> "", CONCATENATE(IF(GETCONTEXTVALUE("SITEID")=120,"US::Ground:",""),$shippingprice),"")

There are many business rules that are commonly used. The table below represents just a few of these commonly used rules.

 

Prerequisites


You should be familiar with the following topic:

 

Commonly Used Business Rules


 

Rule Name Channels Explanation/Uses Rule Code

Remove HTML from Description

General

Often, inventory source data is formatted for display on a website and will contain HTML values to customize the display format of an item's description. Many sites, however, do not accept HTML in description fields. Rather than rewriting description text, you could use a business rule function called STRIPHTML to remove HTML tags formatted as < > and </ >. 

  • STRIPHTML(X) where X is the field that you want to strip HTML from.
     
  • REGEXREPLACE(REGEXREPLACE(STRIPHTML($offerdescription),"&+#[a-zA-Z0-9]+;",""),"&[a-zA-Z0-9]+;","")

    This rule uses the STRIPHTML function to remove complete html tags, but also replaces any HTML character codes with blanks.

Adding Data Values Together

General

When customizing data for feeds many businesses will wish to combine inventory source fields into one data value to send to a site. This can be done using the CONCATENATE business rule function. This will allow you to combine as many as 8 fields or text values together into one combined string.

CONCATENATE(X,Y,Z)  where X, Y and Z represent fields or text strings that you are combining together.


CONCATENATE can combine up to 8 values together. Keep in mind that the CONCATENATE function will not automatically put a space between the elements you are combining together. Therefore, if you want a space, be sure sure to add " " as a value fields or strings that you are combining. For example to combine "Hello" and "there" together, the rule would look like this: 

CONCATENATE("Hello"," ","there")

EVAL

General

"Rules that write rules." Example: Use a lookup list that has brand in the left-hand column, and then the right-hand is basically a business rule to use for that brand. 

Some technical notes: 
* EVAL doesn't know how to call your custom functions, so avoid these in your input text. 
* If your input text has a syntax error, EVAL will "drop" the item from feeds.

EVAL(LOOKUP("The List",$brand))

 

Proper Case Rule

General

Useful when data elements are formatted in all capitalized letters. Submitting fields in all caps isn't permitted on most major sites.

PROPER($itemtitle)

Backup Price Field Rule

General

If your price field is blank, you can use another field to populate a price with an "If Blank" rule.

IFBLANK($$regularprice, $$currentprice)

Brand Filter Rule

General

Use this rule on a channel specific template, in conjunction with a "Brand Exclusion List" Lookup List to filter out specific branded items.

isinlist("Brand Exclusion List",$itembrand)

Format Currency Rule

General

Strip currency symbol from price, limit to 2 decimal places.

FORMATCURRENCY(IFBLANK($itembinprice,$itemretailprice))

Marketplace Price Adjustment Rule

General

Adjusts price that can be applied specifically to a marketplace/destination. This example shows 10% price adjustment.

$itembinprice * 1.10

Convert Weight

General

Convert the Weight from kg to lb.

$itemweight * 2.2

Title Optimization Rule

General

Dynamically build or add content-rich attributes to enhance you title.

JOIN(" ",$itembrand,$itemtitle,$color,$size)

Custom Tracking Rule - Single Provider

Shopping/Feeds

This rule appends a custom tracking parameter name/value pair to the product URL. It determines whether or not the product URL already contains a questionmark and uses an ampersand or questionmark accordingly. A rule for each provider is need with the specific parameter value changed to match the provider for each rule.

CONCATENATE($actionurl,IF(CONTAINS($actionurl,"?"),"&","?"),"parametername=value")

Filter Out of Stock Rule

Shopping/Feeds

Filter out of stock items.

$$instock=0 OR TOLOWER($$instock)="out of stock"

Shipping Rule

Shopping/Feeds

This rule can be used in all CSE templates. It will populate the feed with the shipping price, including the correct format for Google Shopping US, assuming the product level shipping price is stored in the "shippingprice" field of the inventory data source.

IF($shippingprice <> "", CONCATENATE(IF(GETCONTEXTVALUE("SITEID")=120,"US::Ground:",""),$shippingprice),"")

0
Your rating: None
0
Your rating: None