FrequentlyViewedSameCategoryList

This is for:

Developer

The FrequentlyViewedSameCategoryList controller recommends the products that have been viewed the most with the products that the user is currently viewing. The recommendations are filtered to show products that have the same category as the ones the user is currently viewing.

Deprecated. The product-recommendation sub-package is deprecated. Use the commerce sub-package instead.

Methods

refresh

Gets new recommendations based on the current SKUs.

setSkus

Sets the SKUs of the products to fetch recommendations for.

Parameters

  • skus: string[]

    The SKUs of the products to fetch recommendations for.

subscribe

Adds a callback that’s invoked on state change.

Parameters

  • listener: () => void

    A callback that’s invoked on state change.

Returns Unsubscribe: A function to remove the listener.

Attributes

state

The state of the FrequentlyViewedSameCategoryList controller.

Properties

  • error: SearchAPIErrorWithStatusCode | null

    An error returned by the Coveo platform when executing a recommendation request, or null if none is present.

  • isLoading: boolean

    Whether a recommendation request is currently being executed against the Coveo platform.

  • maxNumberOfRecommendations: number

    The maximum number of recommendations.

  • recommendations: ProductRecommendation[]

    The products recommended by the Coveo platform.

  • skus: string[]

    The SKUs of the products to fetch recommendations for.

Initialize

buildFrequentlyViewedSameCategoryList

Creates a FrequentlyViewedSameCategoryList controller instance.

Deprecated. The product-recommendation sub-package is deprecated. Use the commerce sub-package instead.

Parameters

Returns FrequentlyViewedSameCategoryList

FrequentlyViewedSameCategoryListProps

The configurable FrequentlyViewedSameCategoryList properties.

Properties

FrequentlyViewedSameCategoryListOptions

Properties

  • additionalFields?: string[]

    Additional fields to fetch in the results.

  • maxNumberOfRecommendations?: number

    The maximum number of recommendations, from 1 to 50.

    Default: 5

  • skus?: string[]

    The SKUs of the products to fetch recommendations for.

ProductRecommendation

Properties

  • additionalFields: Record<string, unknown>

    An object containing the requested additional fields for the product.

  • childResults: ProductRecommendation[]

    A list of child product recommendations in a product grouping context.

  • clickUri: string

    A direct link to the product in URL format.

  • documentUri: string

    This parameter is no longer used by the Coveo Usage Analytics service.

  • documentUriHash: string

    Document UriHash in the index.

    Note: This parameter is deprecated. Use the permanentid to identify items in the index.

  • permanentid: string

    The SKU of the product.

  • totalNumberOfChildResults: number

    The total number of items in the group.

  • ec_brand?: string

    The brand of the product.

    From the ec_brand field.

  • ec_category?: string

    The category of the product (e.g., "Electronics", "Electronics|Televisions", or "Electronics|Televisions|4K Televisions").

    From the ec_category field.

  • ec_images?: string[]

    Additional product images in URL format.

    From the ec_images field.

  • ec_in_stock?: boolean

    The availability of the product (i.e., whether it’s in stock).

    From the ec_in_stock field.

  • ec_item_group_id?: string

    The id used for Product Grouping.

    From the ec_item_group_id field.

  • ec_name?: string

    The name of the product.

    From the ec_name field.

  • ec_price?: number

    The base price of the product or variant.

    From the ec_price field.

  • ec_promo_price?: number

    The promotional price of the product or variant.

    From the ec_promo_price field.

  • ec_rating?: number

    A rating system. Ratings range from 0-10.

    From the ec_rating field.

  • ec_shortdesc?: string

    A short description of the product.

    From the ec_shortdesc field.

  • ec_thumbnails?: string[]

    Product images in URL format.

    From the ec_thumbnails field.

Unsubscribe

Call signatures

  • (): void;