Creating the task command to retrieve external recommendations

By extending the DisplayExternalRecommendationActionTaskCmdImpl class, you can retrieve catalog entry recommendations from an external system for display on your store pages.

Before you begin

Review the following topic to ensure that you understand the class you must extend:

About this task

The default DisplayExternalRecommendationActionTaskCmdImpl class does not return any recommendations without customization. You must extend this class and implement the method getRecommendationsFromExternalSystem to retrieve a list of catalog entry IDs from the external system for display in an e-Marketing Spot.

The infrastructure for this customization also includes a prebuilt user interface (see the screen capture in Adding support for external recommendations to the Management Center user interface). If this user interface does not provide the functions that meet your business needs, for example, if you want to base the recommendations on the content of a customer's wish list, then there are additional methods you can extend in the DisplayExternalRecommendationActionTaskCmdImpl class. They are:
  • performExecute: to perform the additional business logic for the task command
  • validateParameters: to validate additional user interface parameters when a business user activates a marketing activity containing the Display Recommendation from External System action element

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a package for your task command file:
    1. Navigate to WebSphereCommerceServerExtensionsLogic > src.
    2. Right-click the src folder; then click New > Package.
    3. In the Name field, type com.your_company_name.marketing.commands.elements.
    4. Ensure that WebSphereCommerceServerExtensionsLogic/src is specified in the Source Folder field.
    5. Click Finish.
  3. In the new package, create a task command implementation that extends from the DisplayExternalRecommendationActionTaskCmdImpl class and implements the getRecommendationsFromExternalSystem method. If required, extend the validateParameters and performExecute methods in the class as well. Give the class a name that uses this syntax: external_recommendation_systemTaskCmdImpl; for example, MyRecommendationEngineTaskCmdImpl.
  4. Register the task command in the CMDREG table. Here is an example of a SQL statement that registers this type of task command:
    insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME) values 
    (0, 'com.ibm.commerce.marketing.commands.elements.DisplayExternalRecommendationActionTaskCmd', 
    'com.mycompany.marketing.commands.elements.MyRecommendationEngineTaskCmdImpl');