Skip to main content

Understand How Sorting Rules Work

Learning Objectives

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

  • Explain the Salesforce Agentforce Commerce for B2C inheritance model for processing sorting rules.
  • State the importance of the default sorting rule.
  • Explain how Agentforce Commerce for B2C breaks sorting rule ties.

How Sorting Rules Work

Sorting rules use product attributes to decide how to order product listings. Attributes are characteristics of products, like price, name, popularity, or custom tags like "new arrival." Prioritizing these attributes creates a multi-level sorting strategy. For example, a primary sorting rule sorts products by price in ascending order, while a secondary rule sorts products with the same price by their rating in descending order.

When configuring sorting rules, you have multiple options. You can configure one rule with a single attribute, a rule with a weighted blend of multiple attributes, or multiple rules that you use throughout your site.

You want to include attributes in your default sorting rule to accommodate both category navigation and keyword search. For example, you use the category position and search placement attributes in your default sorting rule. For more personalized search results, you can create other sorting rules that take priority over these rules.

Sort with Rule Inheritance

To process sorting rules, Agentforce Commerce for B2C uses an inheritance model based on the storefront’s catalog and category data structure. You can configure a default sorting rule at the catalog root level. All subcategories inherit the catalog rule. This inheritance gives you global coverage and a baseline strategy that you can vary by product type, campaign, or season. You can determine strategies for each category and provide a more specific product sort by overriding the default rule on an individual subcategory level. Here’s the structure.

  • Default
  • Category tree
  • Override a category or subcategory with a different rule

Remember, a search sorting rule is separate from category sorting, just as a keyword search is different from category navigation. To get started, create a map of your site’s category structure, and then determine the strategy you want to use for each category. For example, an athletic footwear retailer creates a new running shoes category. To give the newest products high-visibility positions on the page. For their clearance category, they want to give premium placement to high-inventory products.

Map of a catalog structure for an online family apparel outlet. The map shows top categories: Mens, Womens, Kids, New Arrivals, and Sales. Sub-categories include Shoes, Apparel, Tops, Boys Shoes, and Girls Shoes.

Break Sorting Ties

During a search results sort, Agentforce Commerce for B2C evaluates products by the value in the top attribute in the sorting rule list. It breaks ties in the values of the first attribute by using the second attribute. It then breaks ties in the values of the second attribute by using the values of the third attribute, and so on. This process continues for all of the sorting rule’s attributes. If products still have the same value on the last level of the sorting attribute the index order is used to break ties. The index order is not visible and can change with every index rebuild.

This example demonstrates how a sorting rule with three attributes sorts five products.

  1. product.searchPlacement: Sort products by search placement and specify products that you want to appear first. Sort by the product name attribute in ascending order.
  2. activeData.returnRate: Sort by lowest return rate (active data attribute) in ascending order.
  3. activeData.salesVelocityWeek: Sort by highest sales velocity (active data attribute) in descending order.

Apply the rule to the new running shoe category that includes these running shoe products:

  • Flow Flyknit
  • Smooth Trail
  • Air Flow Stride
  • Air Float Max
  • Cheetah Ride
  • Happy Trail

Here’s how Agentforce Commerce for B2C sorts these products.

  1. Agentforce Commerce for B2C applies the product.searchPlacement attribute. This attribute sorts products alphabetically based on the catalog structure. The attribute puts the products into two groups, each with three items tied for position. Group 1 products get a value of one, and Group 2 products get a value of two. Items with the same value appear in any order within their group. The current placement looks like this:

Product Sort Order After Attribute 1 is Applied

Attribute Value 1 Ascending

Air Float Stride

1

Flow Flyknit

1

Smooth Trail

1

Cheetah Ride

2

Happy Trail

2

Air Float Max

2

  1. From here on out, the sorting process handles Group 1 and Group 2 independently. No matter how the next sorting attributes work out, Group 1 always fills product positions 1–3, and Group 2 fills positions 4–6.
  • To break the ties attribute 1 created, Agentforce Commerce for B2C applies attribute 2, the activeData.returnRate attribute. This attribute sorts by the lowest return rate (an active data attribute) in ascending order. Agentforce Commerce for B2C applies attribute 2 to Group 1 and Group 2 separately.
  • In Group 1, Flow Flyknit gets a value of 2, which puts it at the highest rank in the group. Air Float Stride and Smooth Trail tie with a value of 3.
  • In Group 2, Happy Trail gets a value of 1, which puts it at the highest rank in that group. Cheetah Ride and Air Float Max tie with a value of 2.
  • Group 2 shows how the sorting rule process sticks to the results of each tie-breaking attribute. Happy Trail has the lowest return rate of all the shoes, but because rule 1 put Happy Trail in Group 2, its highest sort order position is level 4 (the top spot in Group 2). The same applies to Cheetah Ride and Air Float Max.

This table shows how the attribute 2 results translate into the attribute 2 product sort order:

Product Sort Order After Attribute 1 is Applied

Attribute 2 Value Ascending

Product Sort Order After Attribute 2 is Applied

Attribute 2 Product Sort Order Values

Air Float Stride

1

3

Flow Flyknit

1

Flow Flyknit

1

2

Air Float Stride

2

Smooth Trail

1

3

Smooth Trail

2

Cheetah Ride

2

3

Happy Trail

3

Happy Trail

2

1

Cheetah Ride

4

Air Float Max

2

3

Air Float Max

4

  1. Since attribute 2 resulted in two product position ties, Agentforce Commerce for B2C applies attribute 3 to break the tie at position 2 in Group 1 and the tie at position 4 in Group 2. attribute 3, activeData.salesVelocityWeek, sorts by the highest sales velocity (an active data attribute) in descending order.
  • In Group 1, Smooth Trail gets a value of 4, and Air Float Stride gets a value of 3. Since 4 sorts higher than 3 in descending order, Smooth Trail takes sort order position 2, and Air Float Stride takes position 3.
  • In Group 2, Cheetah Ride gets a value of 6, and Air Float Max gets a value of 1. Since 6 sorts higher than 1 in descending order, Cheetah Ride takes sort order position 5, and Air Float Max takes position 6.

This table shows how the attribute 3 results translate into the rule 3 product sort order:

Product Sort Order After Attribute 2 is Applied

Attribute 3 Value Descending

Product Sort Order After Attribute 3 is Applied

Attribute 3 Product Sort Order Values

Flow Flyknit

1

5

Flow Flyknit

1

Air Float Stride

2

3

Smooth Trail

2

Smooth Trail

2

4

Air Float Stride

3

Happy Trail

3

2

Happy Trail

4

Cheetah Ride

4

6

Cheetah Ride

5

Air Float Max

4

1

Air Float Max

6

It’s important to pay close attention to rule attribute order because changing it can change the placement, which affects the shopper experience.

You can take the guesswork out of which sort order to use by running an A/B test with both rules. You can also combine the two attributes into one rule and give them a 50/50 weighting.

Fine-Tune Sorting Rules

To help you order sorting rules, use this search results sort order list. Agentforce Commerce for B2C gives each type of rule priority over the rules that follow.

  1. Explicit category placement: Assign a position for a product in the results returned for a category. Use this rule for shopper browsing, not for keyword searches.
  2. Explicit product placement: Assign the search placement attribute for a product to the values 1-8 (NLA - Top Featured).
  3. Explicit search rank: Assign low, medium, or high in the product search rank attribute.
  4. Availability ranking: The availability of an item influences its position in the search results, so that out-of-stock items appear at the end of the search results.
  5. Text relevance: You can boost the importance of certain attributes. If a boosted attribute includes a search term, it's treated as more significant than other fields.

Boosting the product name attribute, for instance, ensures that matches in the product name are prioritized over those in longer descriptions. This only works in a search-specific sorting rule.

  1. Term frequency: If you remove sorting rules, the search engine bases results on the frequency of the search term in the document’s indexed fields. This situation can happen when you configure search to include content in the search results.

You use the Show Orderable Products Only setting to remove unavailable products from the search results. You can remove individual unavailable products from the search results as well.

Here’s a typical default sorting rule in Business Manager, called best-matches. It looks just like the sort order list, without availability ranking and term frequency.

The default sorting rule, called best-matches, uses static sortings (category position, search placement, and rank), text relevance, and then explicit sortings.

Sum It Up

In this unit, you learned the importance of the default sorting rule and sorting rules best practice sort order. You explored how Agentforce Commerce for B2C uses inheritance as it processes sorting rules and how it breaks sorting rule ties. Next, you learn how to create Agentforce Commerce for B2C sorting rules in Business Manager.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈