Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Customize exported product information

Describes how to customize which products are exported for use by Optimizely Product Recommendations and what product data is included from Optimizely Commerce Connect.

The export function has properties you can set through code on the default CatalogFeedSettings instance:

var catalogFeedSettings = ServiceLocator.Current.GetInstance<CatalogFeedSettings>();
    catalogFeedSettings.DescriptionPropertyName = "...";
  • ExcludedAttributes – Specifies the product properties to exclude from the catalog feed.
  • DescriptionPropertyName – The product feed requires each item (product) to have a description. Set this value to the property name to use as a description. Default value is Description.
  • AssetGroupName – Identifies the asset group whose first asset is used for the item's image link. The default value is default.

API extension points

To use the following API extension points, add a custom implementation of an interface and register it in the dependency injection container. For information, see Dependency injection in the Optimizely Content Management System (CMS) Developer Guide.

ICatalogItemFilter

Implement this interface to exclude entries from the export. The default implementation excludes any entry that is not published.

IEntryInventoryService

This interface has methods that return the quantity available for purchase.

  • GetInventory(IEnumerable<VariationContent> variations) – Returns the quantity considered available at the product level. The default implementation sums the quantity across inventory locations and all product variants.
  • GetInventory(EntryContentBase entry) – Returns the quantity considered available for an individual product variant, a product without its parent product, or a package. The default implementation sums the quantity across inventory locations.

IEntryUrlService

This interface has methods for getting the entry's URLs and an image representing the entry. These URLs are fed back in the recommendation data and are also used in other channels.

  • GetExternalUrl(EntryContentBase entry) – Returns the URL of the entry's product detail page. The default implementation uses the content URL returned from IUrlResolver.
  • GetImageUrl(EntryContentBase entry) – Returns the URL of the product image. The default implementation uses the URL of the first available asset, filtered by AssetGroupName in the configuration if set.

IEntryPriceService

This interface controls which prices are used for an entry in the export. Each price consists of a default price and a sale price. Return one price for each currency for which the entry has a price.

The default implementation gets prices in all currencies for each market, using the AllCustomers price type, and selects the lowest unit price for each currency. For each price, the interface calls IPromotionEngine.GetDiscountPrices with the price's currency and market to get a sale price for the entry.

IEntryAttributeService

This interface contains the following methods for getting product information:

  • GetTitle(EntryContentBase entryContent) – Returns the product title. The default implementation uses DisplayName if it is set, falling back to Name.

  • GetDescription(EntryContentBase entryContent) – Returns the product description. The default implementation reads the property named by DescriptionPropertyName in the configuration.

  • GetAttributes(EntryContentBase entryContent) – Returns additional product data to include in the export. The default implementation returns all non-system properties, filtered by ExcludedAttributes defined in the configuration. To do more advanced filtering, or to add or change values, a custom implementation can:

    • Use the dependency injection intercept pattern (see Dependency injection) to call the base implementation.
    • Proceed with additional filtering.