Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Explore Sorting Rule Strategies

Learning Objectives

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

  • Describe common sorting rule strategies you can use for sale, new arrivals, and top sellers sorting results.
  • Explain how dynamic attributes work.
  • Explain how to use manual sorting rules to optimize the sort order on the catalog and search results pages.
  • Explain how product attributes can help you customize your search results.
  • State how the Storefront Toolkit helps with dynamic sorting.

Make a Plan

Brandon Wilson explored how sorting rules work in the last unit. Now he wants to develop a strategy that connects shoppers with the products they want to buy, while maximizing his company’s return on investment. He focuses on these result types.

  • New Arrivals: Sell exciting new products
  • Top Sellers: Highlight what other shoppers like the most
  • Search: Show shoppers what they want to see
  • Items On Sale: Encourage shoppers to consider end-of-season merchandise

Three results types: New Arrivals, Top Sellers, Search, and Items On Sale

Here are his goals and sorting rule plans.

Result Type

Goal

Sorting Rule Plan (in attribute order)

New Arrivals

Control the top 1 to 2 rows of a results grid, followed by new arrivals 

  1. Category Position/Search Placement
  2. isNew custom attribute
  3. isSale custom attribute
  4. Views, SKU Coverage, and Look to Book

Top Sellers

Place top sellers at the top of the page.

  1. Category Position
  2. isSale custom attribute
  3. Revenue, SKU coverage, Conversion, and Units

Search

Boost products that are most relevant to the shopper’s search term

  1. Search Placement/Search Rank
  2. SKU Coverage, Revenue, Look to Book, text Relevance, and predictive (Commerce Cloud Einstein)

Items On Sale

Sort products in the Sales category by SKU coverage, Sales velocity, and best sellers

  1. Category Position/Search Rank
  2. Dynamic rule: Sales Velocity, and isSale
  3. Sales Velocity, ATS, Predictive, and Revenue

To meet these requirements, he takes a look at:

  • Manual sorting rules
  • Product attributes in sorting rules
  • Dynamic attributes

In this module, we assume you are a Salesforce B2C Commerce merchandiser with the proper permissions to perform these tasks. If you’re not a B2C Commerce merchandiser, that’s OK. Read along to learn how your merchandiser would take these steps in a staging instance. Don’t try to follow our steps in your Trailhead Playground because B2C Commerce isn’t available in the Trailhead Playground.

If you have a development instance of B2C Commerce, you can try out these steps in your instance. If you don’t have a development instance, ask your manager if there is one that you can use.

Manual Sorting Rules

Manual attributes include category position, search placement, and search rank. Only after they are activated manually in Business Manager can they be used in a sorting rule.

Category Position

Brandon uses this attribute in a sorting rule to make sure products within a certain category sort exactly the way he wants. To create this sorting rule, he needs to do two things.

  1. Assign a category position to products within a category.
  2. Create a sorting rule that uses the category position attribute.

For example, he wants B2C Commerce to sort men’s shorts in a certain order. So, he assigns the order position to these products manually in the Business Manager. Then he adds the category position attribute to a sorting rule. Here’s how to assign the sort order position. 

  1. Open Business Manager.
  2. Click site > Merchant Tools > Products and Catalogs > Catalogs.
  3. Select your catalog and a category: mens
  4. Select sub-categories: mens-clothing and mens-clothing-shorts
  5. Enter numbers (integers) into the Position column to order the products.
    In Business Manager, the Products and Catalogs section, enter integers into the product position fields to assign category position.
Note

You can also manage products within the product grid view.

Brandon adds the category position attribute to a sorting rule, along with another attribute to accommodate keyword search results. (He creates sorting rules in the next unit.)

Search Placement

For some products, assigning a category position is too specific, and category position only works with categories. With search placement, Brandon can do these things.

  • Group certain products together.
  • Promote or demote certain products.
  • Ensure certain products appear next to each other.
  • Sort subcategories in a particular order within a main category.

He can assign search placement codes that rank products from high to low, using the values in Business Manager or creating his own. Here are the values in Business Manager.

  • NONE—This is the default value.
  • 8 (Top Featured Product)
  • 7 (Featured Product)
  • 6 (Product)
  • 5 (Secondary Product)
  • 4 (Featured Accessory)
  • 3 (Accessory)
  • 2 (Spare Part)
  • 1 (NLA Product)
Note

To change the number or meaning of the Business Manager values, edit the system object types, product attribute definitions.

Brandon uses search placement for the relevance of a particular product within a category. For example, within the womens category, he wants shoes to appear first in search results, and tights last. He must assign a search placement code to each subcategory within the womens category. Otherwise, the products he wants to list between shoes and tights will have a null value and display below the tights.

Here’s how to select a search placement value for one subcategory.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Products and Catalogs > Catalogs.
  3. Select your catalog and then the womens category.
  4. Click Edit to the right of the shoes category.
  5. Click the Category Attributes tab.
  6. For Search Placement, select the placement value: 8 (Top Featured Product)
    All products in this category are assigned this value, unless a different value is selected for a subcategory or the product itself.
    In Business Manager, select a search placement value for a category.

Brandon creates a sorting rule to include the new product attribute. (He creates sorting rules in the next unit.) He can also assign a search placement value to an individual product. 

Search Rank

To promote a group of products, Brandon can explicitly set the search rank of a group of products to these.

  • 3 (High)
  • 2 (Medium)
  • 1 (Low)

Brandon wants to phase out seasonal women’s tops. Here’s how he gives them a search rank of high to move them to the top.

  1. Open Business Manager.
  2. Click site > Merchant Tools > Products and Catalogs > Catalogs.
  3. Click your main catalog ID.
  4. Click Edit to the right of the womens-tops category.
  5. Click the Category Attributes tab.
    All products in this category are assigned this value, unless you assign a different value for a subcategory or the product itself.
    (To set it for the product, click site > Merchant Tools > Products and Catalogs > Products > product.)
  6. Scroll down to the Search Rank section.
  7. Select the search rank: 3 (High)

    In Business Manager, select a search rank value for a category.
  8. Click Apply.

Make sure you include the search rank product attribute in a sorting rule. While you can add search rank to a dynamic attribute, don’t do this because the value resolves to zero. 

Product Attributes

Brandon can use the B2C Commerce product system object attributes in a sorting rule or create custom attributes. Product attributes define product details, such as product ID, title, small description, size, and so on.

Brandon creates a custom product attribute called isSale to push sales items to the bottom of the search results. Here’s how he creates the attribute.

  1. Open Business Manager.
  2. Click Administration > Site Development > System Object Types.
  3. On the System Object Type List page, click the name of the object you want to edit: Product
  4. Click the Attribute Definitions tab.
  5. Enter isSale into the ID or Name field and click Find.
    • If it’s there, you’re all set. You can skip to creating the sorting rule.
    • If it’s not there, click New.
  6. Enter the following information:
    • Enter a unique ID for the attribute: isSale
    • Enter a display name: On sale?
    • Value Type: Boolean
  7. Click Apply. You can now use this attribute in a sorting rule. (In the next unit, Brandon uses this attribute to create a sorting rule.)

The product object has a new attribute, but it’s not populated across the database. Brandon can populate the new attribute manually or through a bulk update or a product feed. Here’s how to add the new attribute as a field on the Business Manager product page General tab.

  1. Open Business Manager.
  2. Click Administration > Site Development > System Object Types.
  3. On the System Object Type List page, click Product.
  4. Click the Attribute Grouping tab.
  5. Click Edit for the Business Manager display group: Search Refinements
  6. Click the gray ellipses, then locate and select isSale. You can now populate isSale data in Business Manager.

Dynamic Attributes

Dynamic attributes contain multiple active data attributes, each providing a percentage of the whole, or a weighted value. B2C Commerce uses them to make near real-time sort adjustments based on site activity and sales, for both category and keyword search. For example, Brandon wants to sort search results by a combination of revenue, units, look to book ratio, and availability, each with a weight of 25%. He can change the weighting whenever he wants, and test one scenario against another with B2C Commerce A/B Testing.

Null Values

A null value means that B2C Commerce calculated null for a product’s value. For standard attributes and single active data attributes, products with null values display at the bottom of the results set, regardless of the configured direction. For dynamic attributes, you can set a default for null value handling, as follows.

Default

How it Sorts Null Values

Goal

Minimum

End of the result set. 

  • To give newer products a boost, placing them higher within the sort order.
  • For products with no predictive sort score.

Average

Middle of the result set. 

  • If you have incomplete data for some products, but don’t want a null value to sort them to the end of the result set.

Maximum

Beginning of the result set. 

  • If you have new products with incomplete data that you want to promote.

Next Steps

In this unit, you explored common sorting rule strategies and learned how to configure manual sorting rules, create dynamic attributes, and use product system object attributes. Next, you learn how to configure sorting rules.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback