Skip to main content

Create Sorting Rules

Learning Objectives

After completing this unit, you’ll be able to:

  • Configure a sorting rule using single attributes.
  • Preview a category sorting rule.
  • Configure a hybrid sorting rule.
  • Configure a storefront sorting option using a dynamic attribute.

Create Sorting Rules

Brandon Wilson, Cloud Kicks merchandiser, is ready to create his sorting rules. He wants to start small and then strive for more granularity as his confidence grows. Here are the sorting rules he wants to configure.

  • A sorting rule with a single attribute
  • A hybrid sorting rule
  • A storefront sorting option with a dynamic attributes

Once he’s finished, he can preview his results.

Create a Sorting Rule with a Single Attribute

Brandon wants to order search results based on the availability of items, and thinks the availability ranking attribute might be a good choice. But that attribute only groups the affected products and pushes them to the end of the search result list. It doesn’t sort the products by descending availability.

To use availability ranking in a sorting rule, he must first do these things.

  • Enable or disable dynamic ranking based on availability.
  • Set an availability threshold that determines if a product is pushed to the end or to the beginning of the search results. (Business Manager: site > Search > Search Preferences.)

Availability ranking isn’t the only product inventory related attribute. Which attribute Brandon chooses depends on how he manages the inventory and products on his site. Here’s how he can decide.

Goal

Attribute to Use

Attribute Type

Keep out-of-stock products online.

Availability Rank 

Standard Attribute


Configure base products with multiple variations that have varying stock across the range of sizes/colors/materials.

SKU Coverage 

Availability Model

Boost products that have a lot of units left.

ATS

Availability Model

Boost products with a good range of stock across all variations.

Combine ATS and SKU Coverage in a dynamic attribute

Availability Model

Boost slow-sellers.

Sales Velocity or Time To Out Of Stack (TTOS)

Active Data

Brandon decides to use the available to sell (ATS) attribute to boost high-inventory products in his Sales category to the top of the search results. His sorting rule uses ATS first (from highest to lowest) and then revenue to break ties. For any products with the same score, the rule displays the ones with higher revenue first.

Here’s how to create this sorting rule.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Sorting Rules.
  3. Click New.
    In Business Manager, the Sorting Rules page has three sections: Sorting Rules, Attributes, and Preview.
    The page has three sections: Sorting Rules, Attributes, and Preview.
  4. Enter a unique rule ID and description: cloudkicks-01
  5. Click Add in the Attributes section.
    On the Business Manager Sorting Rules page, select the attributes to add to a sorting rule.
  6. From the dropdown, scroll to the section you want, and select:
    • ATS
    • Revenue (30 Days) (activeData.revenueMonth)
  7. Click Apply.

    In the Business Manager Sorting Rules module, the new sorting rule uses two attributes: ATS ands Revenue (30 Days).
  8. Keep the Text Relevancy settings to No for both attributes.
    Selecting Yes means that the text relevance score (from 0 through 1) is multiplied by the score of the attribute you use for the rule. This is the equivalent of a 50%-50% weighting between the selected attribute and the text relevance score. Use this when multiple items might have the same score from the sorting attribute, such as a recommendations sort, or when sorting for best-selling items.
  9. In the Direction column, leave both attributes Descending.

Preview Sorting Rules

Here’s how Brandon previews the sorting rule.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Sorting Rules.
  3. Select the sorting rule you just created: cloudkicks-01
  4. In the Preview section, select Sale from the category list.
  5. Enter a search term: shorts
  6. Click Preview.

Products appear based on the search term. If no products meet the specific attribute requirements, you still see products in the preview category that have the search term in the product name.
In Business Manager, preview sorting rules by selecting the rule and a category, and entering a search term.

You can use the Storefront Toolkit to examine search results. The tool shows the sorting rule used to determine search results, the sorting criteria within the rule, and the sorting criteria values for each search result.

Create a Hybrid Sorting Rule

Brandon wants to configure a hybrid sorting rule that’s a combination of category position and a custom product attribute called isSale to push sales items to the bottom of the search results. He created this attribute in the previous unit, and now creates a new sorting rule to use it. Also, he doesn’t want to end his sorting rule in a tie, so he adds a dynamic rule to avoid it. Here’s how he does it.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Sorting Rules.
  3. Click New.
  4. Enter a unique rule ID and description: cloudkicks-03-hybrid
  5. Click Add in the Attributes section and select from the dropdown:
    • Standard attribute: Category Position
    • Product attribute: On sale?
    • Active data attribute: Views
  6. Click Apply.
    In the Business Manager Sorting Rules module, the new hybrid sorting rule uses three attributes: Category Position, On sale, and Views (30 Days).
  7. Keep the Text Relevancy settings to No for all attributes.
  8. In the Direction column, leave them set to Ascending and Descending, respectively.
  9. Click Apply.

Create a Storefront Sorting Option with a Dynamic Attribute

Brandon wants to configure a new storefront option for the dropdown that shows a combination of new arrivals and bestsellers. To do this, his storefront option must use a sorting rule that consists of a dynamic attribute. This means that he must do the following.

  1. Create a dynamic attribute.
  2. Create a sorting rule that uses the dynamic attribute.
  3. Create a storefront option that uses the sorting rule.

He wants his new dynamic attribute, called hotItems, to blend sales velocity (descending, average, 60% weighting) and Views (ascending, minimum, 40% weighting). B2C Commerce calculates the sales velocity and days available, with the search results now showing a blend of both.

Here’s how Brandon creates the dynamic attribute.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Sorting Rules.
  3. Click Dynamic Attribute.
  4. Click New.
  5. Enter a unique attribute ID and description: hotItems
  6. Click Add in the Attributes section.
  7. Select active data attributes from the drop down:
    • Sales Velocity (30 Days)
    • View
  8. Select the settings for each attribute:
    • Descending, Average, 60% weighting
    • Ascending, Minimum, 40% weighting
  9. Click Apply.
    In the Business Manager Sorting Rules module, create a new dynamic attribute (hotItems) with two attributes: Sales Velocity and Views.

Here’s how Brandon creates the sorting rule.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Sorting Rules.
  3. Click New.
  4. Enter a unique rule ID and description: cloudkicks-02-dynamic
  5. Click Add in the Attributes section.
  6. Select the dynamic attribute from the dropdown: hotItems
  7. Click Apply.
  8. Set Text Relevancy (No) and Direction (Descending). If you set text relevancy to Yes, B2C Commerce multiples the sorting attribute score by the text relevancy score.

    In Business Manager, create a sorting rule, cloudkicks-02 that uses a dynamic attribute, hotItems.

Here’s how Brandon uses the sorting rule in his new storefront sorting option.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Search > Storefront Sorting Options.
  3. Click New.

    In Business Manager, Storefront Sorting Options module, create a new sorting option.
  4. Keep the site language: Default
    When you select a new language to configure, the values for the Display Name clear for that language. If you don't have sites in different languages, select Default or the locale for the current site.
  5. Enter a unique ID: cloud-kicks-topsellers
    This ID is used internally by B2C Commerce.
  6. Enter a Display Name: Holiday Top Picks
    This is the name that displays in the storefront.
  7. Select a sorting rule from the dropdown: cloudkicks-02-dynamic
  8. Click Apply.
  9. Click <<Back to List.
  10. Select cloud-kicks-topsellers.
  11. Click the sorting arrowMove to the top icon to make this option a priority.
  12. Click Apply.
    In the Business Manager Storefront Sorting Option module, you can control the storefront option drop down order of display.

The new rule displays at the top of the list and at the top of the storefront option dropdown.

Let’s Wrap It Up

In this unit, you created a sorting rule with a single attribute, a storefront sorting option with a dynamic attribute, and a hybrid sorting rule. Now take the final quiz and earn a new badge.

Resources

Note

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"