Tutorial: Tracking and displaying the most viewed recipes
This tutorial demonstrates how to extend the recipe tutorials to add a new function for displaying the most viewed recipes. This function is implemented using the ranking list framework for marketing actions. The Madisons starter store uses the Management Center Marketing tool to set up the corresponding web activities to display the top viewed recipes in e-Marketing Spots in the storefront.
Additional suggested resources before beginning the tutorial include:
- Product Rankings in the Madisons starter store
- Management Center framework
- Customize marketing
- Create a Web activity
- Add an e-Marketing Spot to a store page (Management Center)
- Add a new trigger, target or action
Learning objectives
After completing this tutorial you should be able to:
- Add a custom campaign element, an Action in this tutorial, to the Management Center.
- Add an e-Marketing Spot to a storefront using the Management Center.
- Customize controller and task commands for capturing, calculating, and displaying the recipe data.
Time required
Expect this tutorial to take 5-6 hours to complete.
Skill level
Intermediate
Audience
This tutorial is intended for WebSphere Commerce developers responsible for customizing the Management Center user interface.
System requirements
Before beginning this tutorial, ensure that you have fulfilled the following prerequisites:
- Installed Rational Application Developer 7.5.5.1 with WebSphere Application Server 7.0.0.3.
- Installed WebSphere Commerce v7.
- Installed WebSphere Commerce Fix Pack 1.
- Installed WebSphere Commerce Feature Pack 1.
- Installed WebSphere Commerce Developer.
- Downloaded the completed tutorial code as reference. Create a temporary file folder, such as RecipeTopBrowsedSource. During the lessons, we will be instructed to copy code from RecipeTopBrowsedSource into the project, where RecipeTopBrowsedSource is the location where you unzipped the sample source code.
- Download the completed tutorial code for WebSphere Commerce v7 and Feature Pack 1.
- Download the completed tutorial code for WebSphere Commerce v7 Feature Pack 2.
Prerequisites
Complete the following tutorials before proceeding with this one:
- Tutorial: Creating the Project BOD service module
- Tutorial: Adding a Recipes tool to the Management Center
- Tutorial: Modifying the storefront to display Recipe information
To complete this tutorial, familiarize yourself with the following terms and concepts:
- Rational Application Developer
- Management Center framework
- XML
- OpenLaszlo
- JSP
- Controller command
- Task command
Lessons in this tutorial
- Define a new marketing action to track and display the most viewed recipes
In this tutorial, we will customize a new action to display the top viewed recipes, so define an action template. The template definitions are stored in XML format in the DMELETEMPLATE table.
- Create a new command to capture the recipe view statistics
In this lesson, we will implement the task command which was specified in the callCmdOnMatch parameter in the Behavior Rule XML definition. This task command is called to perform custom processing of the event. The specified task command must implement BehaviorRuleTaskCmd.
- Calculate the top viewed recipes from the statistics data
A business policy is used to define how to generate the rankings. A ranking type relating to a ranking policy contains two BusinessPolicyCommands: CleanupRankingPolicyCmdImpl and GenerateRankingPolicyCmdImpl. CleanupRankingPolicyCmdImpl cleans and summarizes the ranking statistics data. The purpose of using this command is to delete the out-of-date data that is no longer required and to summarize the data into the reduced database rows, helping control the size of the DMRANKINGSTAT statistics table. The cleanup command must implement the CleanupRankingPolicyCmd interface. Another command, GenerateRankingPolicyCmdImpl, evaluates the statistics data and generates the corresponding ranking list. This command analyzes the existing statistics and populates the DMRANKINGITEM database table. GenerateRankingPolicyCmdImpl must implement the GenerateRankingPolicyCmd interface.
- Create a new Task Command to display the top viewed recipes
In this lesson, you create a new task command to associate with the new action you customized and make the most viewed recipes displayable.
- Customize Management Center to support creating a new Web activity for most viewed recipes
In this lesson, you customize the Management Center Marketing tool to add the custom action. After you complete this lesson, you can create a Web activity with the customized action.
- Create an e-Marketing Spot in the storefront to display the most viewed recipes
In this lesson, you modify existing JSP files for displaying the recipes in the storefront, and create new JSP files to support the new function for the most viewed recipes.
- Verify the customization in the storefront
In this lesson, you test the new function you customized for the most viewed recipes.
Related concepts
Rank list framework for marketing actions
Related tasks
Add an e-Marketing Spot to a store page (Management Center)
Add a new trigger, target or action
Related reference
Product Rankings in the Madisons starter store
Related information
Tutorial: Creating the Project BOD service module
Tutorial: Adding a Recipes tool to the Management Center
Tutorial: Modifying the storefront to display Recipe information