Building similar Recommendation Lightning Component for App Cloud

Now that we have a knowledge of Lightning Components, we are ready to build the following two Lightning Components:

  • ProductViewCapture: This component will be placed on the detail page of the Product Object. It will send data to the Prediction Event Server whenever a user views the Product or an item
  • SimilarProductRecommender: This component is again placed on the detail page of the Product Object, and recommends similar products based on the current Product by making an API callout to the PredictionIO engine

For simplicity, we will assume that an admin will train the application using command line. In the real world, one has to automate the training and choose the best model. The Heroku Buildpack we discussed in the last section of Chapter 3, Building Smarter Apps Using PredictionIO and Heroku, can be one of the options.

As discussed for the API callout to the Heroku endpoints, we will use the Salesforce Apex, and for the UI design, we will adopt SLDS.

The following diagram summarizes the application structure:

You can install all the Apex and Salesforce components used as an unmanaged package using the following link:

https://login.salesforce.com/packaging/installPackage.apexp?p0=04t46000000TOJX
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset