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:
The following pipelets support active merchandising:
|ImportActiveData||Imports 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.|
|ValidateActiveDataFile||Validates 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.|
|Search||Retrieves 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:
|ActiveData||Represents the active data for an object in B2C Commerce.|
|CustomerActiveData||Represents the active data for a Customer in B2C Commerce.|
|CustomerGroup||See Dynamic Customer Groups.|
|ProductActiveData||Represents the active data for a Product in B2C Commerce.|
The following classes directly support active data:
The following classes support active data:
The following classes support searchandising sorting rules:
dw.catalog.SortingRulemethod of the
dw.object.PersistentObjectclass represents a sorting rule.
dw.catalog.SortingOptionmethod of the
dw.object.PersistentObjectclass represents a sorting option for a storefront catalog.
The following properties and methods in the dw.catalog.ProductSearchMode
l class support searchandising:
- sortingRule : SortingRule
- static final SORTING_RULE_PARAMETER : String constant from API ProductSearchModel
- 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.unassignCustomerreject the assigning of customers to dynamic groups through the API.
Customer.getCustomerGroupsreturns a list of static, dynamic, and system groups to which the customer is a member, as follows:
|Returns...||Storefront Sessions||Job Sessions|
|Dynamic customer groups||x|
|Static customer groups||x||x|
|System groups: Everyone and Registered||x||x|
|System groups: Unregistered||x|
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.
Select Administration > Site Development > System Object Types.
On the System Object Type List page, select ProductActiveData or CustomerActiveData.
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.
On the System Object Type List page Attribute Definitions tab, click New.
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.
Click << Back.
Click the Attribute Grouping tab.
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.
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:
- 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.
- The customer refines the search by category Men's. The refined results are sorted by the default rule set for the Men's category.
- 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.
- 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:
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.