Class ItemRecommendation

Object
ItemRecommendation
All Implemented Interfaces:
Serializable

public class ItemRecommendation extends Object implements Serializable
Represents a scored item recommendation calculated by logic. Intended for use in Cross-sell and up-sell.

Create an instance with api.newItemRecommendation(id, score). A recommendation logic returns the instances it builds. The higher the score, the more relevant the item.

Example:


 return [
         api.newItemRecommendation("SKU-100", 0.92),
         api.newItemRecommendation("SKU-200", 0.47)
 ]
 
Since:
5.0 - Collins
See Also:
  • Constructor Details

    • ItemRecommendation

      public ItemRecommendation(String id, Double score)
      Creates a recommendation for one item.
      Parameters:
      id - Item ID, for example a Stock Keeping Unit (SKU). An entry with this ID must be present in the Master Data.
      score - Relevancy score. The higher the score, the more relevant the item.
  • Method Details

    • getId

      public String getId()
      Returns the ID of the recommended item.
      Returns:
      The item ID, for example a SKU.
    • setId

      public void setId(String id)
      Sets the ID of the recommended item.
      Parameters:
      id - Item ID, for example a Stock Keeping Unit (SKU). An entry with this ID must be present in the Master Data.
    • getScore

      public Double getScore()
      Returns the relevancy score of the recommended item.
      Returns:
      The relevancy score. The higher the score, the more relevant the item.
    • setScore

      public void setScore(Double score)
      Sets the relevancy score of the recommended item.
      Parameters:
      score - Relevancy score. The higher the score, the more relevant the item.
    • toString

      public String toString()
      Overrides:
      toString in class Object