Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Product Recommendation

Product Recommendation

Product Recommendation is a type of product association that promotes products based on what other customers are buying. For a "source" product on display, Product Recommendation targets products that were bought by customers who buy the source product. For example, Customer A bought a Canon camera and a Kingston SD card. When Customer B enters the Canon Camera's product page, Product Recommendation recommends Customer B to also buy a Kingston SD card.

Product Recommendations are computed by the ProductRecommendationService Quartz job in the Commerce Manager.

Key classes and files

  • ProductAssociation - A representation of the link between a source and target product.
  • ProductRecommendationService - A service for computing product recommendations.
  • RecommendationSet - A set of product recommendations computed by the ProductRecommendationService.
  • productMacros.vm - A Velocity template for displaying products.

How it works

Product Recommendation Calculation

ProductRecommendationService uses the algorithm in updateRecommendations() to compute product recommendations:

  1. Retrieve purchase data from the database as (CustomerId, ProductId) tuples, where the customer CustomerID bought the product ProductID.
  2. Convert the purchase data into a map where the customerId is the key and the list of products purchased is the value.
  3. Create a map of product recommendations by mapping each source product to other products they were purchased with.
    • This map maps product ids to RecommendationSet instances. RecommendationSet counts the number of times other products were purchased with the source product and sorts the results in decreasing order. RecommendationSet returns the top N most frequent products as recommendations.
  4. For each source product with recommendations:
    1. Load the source product and its ProductAssociations
    2. Remove any product recommendation type ProductAssociations that are not in the new product recommendations set.
    3. Add any new product recommendations as new product recommendation type ProductAssociations.

Configuring Product Recommendation

The Product Recommendation calculation schedule is configurable via the Commerce Manager's quartz configuration file.

To configure the max number of days of order history to use in Product Recommendation computation, change the COMMERCE/STORE/PRODUCTRECOMMENDATIONS/numberOrderHistoryDays system setting.

To configure the max number of most frequent products to use as recommendations, change the COMMERCE/STORE/PRODUCTRECOMMENDATIONS/numberMaxRecommendations system setting.

To disable product recommendation, you can assign a -1 to either of the above system settings.

Note:

Disabling product recommendation will not remove existing product recommendations.