Skip to main content
Version: 1.0.x

Extension Point: Product Recommendations

Basics​

ParameterValue
Extension Point KeyPRODUCT_RECOMMENDATIONS
Extension Point NameProduct recommendations
Extension InterfaceProductRecommendations
Supports Multiple Extensions?No
Selector TypeStore
Available Since1.0.0

Use Cases​

Extensions implementing this Extension Point can determine which products to recommend for specific source products. The results are returned by the Cortex "recommendations" resource.

Methods​

getRecommendations​

The getRecommendations method is invoked whenever a Cortex client requests recommendations for a product.

The XPFProductRecommendationsContext object that is passed to getRecommendations extends XPFPaginatedContext, which contains pageSize and pageNumber so that paginated results can be returned. It is the responsibility of the plugin developer to handle these paginated requests appropriately.

There is an embedded extension named ElasticPathProductRecommendationsRetrieval with priority 50 that reads recommendations from the Product Associations table in the Elastic Path database.

note

This extension point only supports a single extension, so if multiple are defined, the highest priority extension will be invoked.

Extension Sample​

@Extension
@XPFAssignment(extensionPoint = XPFExtensionPointEnum.PRODUCT_RECOMMENDATIONS, priority = 10)
public class SampleProductRecommendationsRetrieval extends XPFExtensionPointImpl implements ProductRecommendations {

@Override
public XPFProductRecommendations getRecommendations(final XPFProductRecommendationsContext context) {
return new XPFProductRecommendations(1, Collections.singletonList(new XPFProductRecommendation("recommendedSku")));
}
}