Extension Point: Product Recommendations
Basics
Parameter | Value |
---|---|
Extension Point Key | PRODUCT_RECOMMENDATIONS |
Extension Point Name | Product recommendations |
Extension Interface | ProductRecommendations |
Supports Multiple Extensions? | No |
Selector Type | Store |
Available Since | 1.0.0 |
note
This extension point only supports a single extension, so if multiple are defined, the highest priority extension will be invoked.
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.
There is an embedded extension named ElasticPathProductRecommendationsRetrieval
with priority 1050 that reads recommendations from the Product Associations table in the Elastic Path database.
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.
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")));
}
}