Customize Active Data

Customize your application’s active data processing by using business objects, and B2C Commerce API pipelets and scripts.

The following business objects, which you can customize, support this feature:

  • CustomerActiveData
  • CustomerGroup
  • ProductActiveData
  • SlotConfiguration

The following pipelets support active merchandising:

PipeletDescription
ImportActiveDataImports either ProductActiveData or CustomerActiveData attributes from a .csv file. The feed name contained in the file determines both the type of data and feed for the import process.
ValidateActiveDataFileValidates the given active data .csv file and returns a status for the results of the validation. If the validation operation executes without process errors, regardless of the .csv file’s validity, the pipelet returns next. It then continues to the next node in the pipeline. If the given file doesn't exist in the given path the pipelet exits in a pipelet error.
SearchRetrieves search results. A SortingRuleID input parameter represents the ID of the sorting rule used to sort the products. The existing parameters SortBy1, SortBy1Direction, SortBy2, SortBy2Direction, SortBy3, and SortBy3Direction, can also be used with explicit sorting attribute steps in sorting rules.

The following classes support active merchandising:

ClassDescription
ActiveDataRepresents the active data for an object in B2C Commerce.
CustomerActiveDataRepresents the active data for a Customer in B2C Commerce.
CustomerGroupSee Dynamic Customer Groups.
ProductActiveDataRepresents the active data for a Product in B2C Commerce.

The following classes directly support active data:

  • dw.campaign.ProductActiveData extends dw.object.ExtensibleObject
  • dw.campaign.CustomerActiveData extends dw.object.ExtensibleObject

The following classes support active data:

  • dw.catalog.ProductAvailabilityModel - getTimeToOutOfStock(), getAvailability(), and getSKUCoverage()
  • dw.customer.Customer - CustomerActiveData getActiveData() and getLastOrderDate() methods added.

The following classes support searchandising sorting rules:

  • The dw.catalog.SortingRule method of the dw.object.PersistentObject class represents a sorting rule.
  • The dw.catalog.SortingOption method of the dw.object.PersistentObject class represents a sorting option for a storefront catalog.

The following properties and methods in the dw.catalog.ProductSearchModel class support searchandising:

  • Properties
    • sortingRule : SortingRule
    • static final SORTING_RULE_PARAMETER : String constant from API ProductSearchModel
  • Methods
    • setSortingRule(rule: SortingRule) : void
    • getSortingRule() : SortingRule
    • urlSortingRule(action : String, rule : SortingRule) : URL
    • urlSortingRule(url : URL, rule : SortingRule) : URL

The following methods of the CatalogMgr class support searchandising:

  • static getSortingRules() : Collection
  • static getSortingRule(ID : String)
  • static getStorefrontSortingOptions() : List
  • static getStorefrontSortingOption(ID : String)

The scripting API provides read, but not write, access to all active data metrics.

The following scripting APIs support dynamic customer groups:

  • The methods dw.customer.CustomerGroup.assignCustomer and dw.customer.CustomerGroup.unassignCustomer reject the assigning of customers to dynamic groups through the API.
  • Customer.getCustomerGroups returns a list of static, dynamic, and system groups to which the customer is a member, as follows:
Returns...Storefront SessionsJob Sessions
Dynamic customer groupsx 
Static customer groupsxx
System groups: Everyone and Registeredxx
System groups: Unregisteredx 

Customer#isMemberOfCustomerGroup also checks for memberships in dynamic groups.

You can create custom attributes for the ProductActiveData or CustomerActiveData business objects. Attributes added to these business objects are not replicated between instances and can't be exported.

  1. Select Administration > Site Development > System Object Types.

  2. On the System Object Type List page, select ProductActiveData or CustomerActiveData.

  3. On the System Object Type List page, click the Attribute Definitions tab.

    If you have already created a custom attribute, you can find and add it, otherwise, proceed to the next step.

  4. On the System Object Type List page Attribute Definitions tab, click New.

  5. Enter the properties for the custom attribute and click Apply.

    These attributes are created identically to any other custom attributes. However, you can't create the following attribute types for active data: Password, Image, Text, Html, or Email.

    To see the attributes in Business Manager, you must add them to the active data tab for products.

  6. Click << Back.

  7. Click the Attribute Grouping tab.

  8. On the System Object Type List page Attribute Groupings tab, click Edit for the section on the active data tab where you want to add your attributes.

  9. To browse for your custom attribute click .... Check its checkbox and click Select.

To import values into these attributes, you must add them to an import feed definition and an associated active data feed file. See Defining Feeds as your next step.

The Search pipelet SortingRuleID parameter specifies the ID of the sorting rule to use to sort the products. You can also use the SortBy1, SortBy1Direction, SortBy2, SortBy2Direction, SortBy3, and SortBy3Direction attributes with explicit sorting attribute steps in sorting rules.

The Search pipelet uses the following rules to order search results:

  • If a SortingRuleID is specified and a valid rule exists with that ID, that rule is used.
  • If no SortingRuleID is specified or the specified ID is unknown or invalid, the default sorting rule for the search refining category is used.
  • If the default sorting rule for the category refined by is invalid or no default rule was set for the category, the inherited default rule of the parent category is used.
  • If the search isn't refined by category or there's no default rule set for any ancestor category, the default rule set for the root category of the storefront catalog is used.
  • If there is no default rule set for the root category, the products are sorted by the sort conditions set using SortByX parameters.
  • If no sorting rule applies, and no SortByX conditions are set, the products are sorted descending by text relevance based on the search term.
  • If no sorting rule applies, no SortByX conditions are set, and there is no search term, the products are not sorted in a particular order.

The following is an example:

  1. A customer searches for jacket on the home page. The search results are sorted by the default rule set for the root category of the storefront catalog.
  2. The customer refines the search by category Men's. The refined results are sorted by the default rule set for the Men's category.
  3. The customer further refines the search by the Raincoats subcategory. Because no default rule is set for Raincoats, the refined results are sorted by the default rule set for the Men's category.
  4. The customer selects Sort by Price (Low-High) in a sorting options dropdown. The sorting rule ID for that sorting option is specified to the Search pipelet. The same refined results are now sorted by the rule with that ID.

If you're implementing active data functionality in an existing storefront, you must tag different pages and change how you use the Search pipeline.

If your storefront is based on the Reference Application, instead of SiteGenesis, consider adding active data tags for the following templates:

TemplateTags
htmlhead.isml<isactivedatahead>
productbreadcrumbs.isml<isactivedatacontext category="${category}">
productsearchbreadcrumbs.isml<isactivedatacontext category="${pdict.ProductSearchResult.category}">
pt_productdetails.isml<isobject object="${pdict.Product}" view="detail"> and <isobject object="${pdict.Product}" view="setproduct">
pt_productsearchresult.isml<isobject object="${ProductSearchHit}" view="searchhit">
categoryTop.isml<isobject object="${ProductSearchHit}" view="searchhit">
topsellers.isml<isobject object="${ProductSearchHit}" view="searchhit">
productdetails.isml<isobject object="${ProductSearchHit}" view="searchhit">
productlisting.isml<isobject object="${ProductSearchHit}" view="searchhit">
set-product.isml<isobject object="${ProductSearchHit}" view="searchhit">
productset-full.isml<isobject object="${ProductSearchHit}" view="searchhit">
product_1x2.isml<isobject object="${ProductSearchHit}" view="searchhit">

If your site was based on Salesforce B2C Commerce, Release 2.8x or earlier, your search and sorting rules were automatically migrated.

If you now want to take advantage of the active merchandising feature, you must make the following changes to your site:

  • Change calls to the Search pipeline to use the SortingRuleID parameter instead of the SortBy parameter if your storefront fits the following criteria. You created your storefront application using the Reference Application (before SiteGenesis). You want to configure storefront search options to use in your application. See the Product and Search pipelines in the latest SiteGenesis Storefront Core cartridge.
  • Also, change the template that sets your sorting options. For example, change your version of the productsortingoptions.isml templates to include code similar to what’s in this file in the latest SiteGenesis Storefront Core cartridge.