Develop > Presentation layer > Customize marketing > Work with Product Advisor > JSP pages in Product Advisor > Sample: Product Advisor JSP files
Sample: Product Comparison JSP files
Product Comparison data is a side by side comparison of a set of products. Each product is represented as either a row or a column in the table, and the values for the product's features are shown in the cells of the table. This example uses the TableElement bean for the table header and the table cells. The DynamicTable bean then displays the product comparison table.
The ProductCompareDataBean is responsible for creating the product comparison data. It also has properties that identify what URL a link in the table should take you to (the metaphor defines attributes as links and this is the link) and what parameters to pass to that page. If productId is one of the specified parameters, then it will be assigned the catentry_id for the product whose link was selected. Any other parameters will be passed through with whatever value they had when this page was loaded. The DynamicTable and TableElement widget beans specify parameters for the table header, the table cell, and finally, the table itself. You should be aware of the following notable parameters:
- The orientation property refers to the layout of the feature names, either horizontally or vertically. If the parameter is horizontal, then the specified feature names display in a row. If the parameter is vertical (the default) then the specified feature names display in a column.
- The pageSize and pageStart properties (on the DynamicTable bean) are used to limit the number of products shown on one page, show the subset being displayed (for example, 11 to 20 of 50) and to provide links for next and previous pages.
The Product Comparison sample JSP file is located...
WCDE_INSTALL\samples\web\pa\pc51.jsp
This sample illustrates how to use the productLinkName property of the ProductCompareDataBean to link to a product display page and make use of the ClickInfo command to collect statistics on the product selected.
The Product Comparison sample JSP file uses the following beans:
Type of Bean Bean Name WebSphere Commerce beans CategoryDataBean Dynamic data beans ProductCountDataBean, GenericLinkDataBean, ProductCompareDataBean, SortByColumnDataBean Widget beans DynamicTable, TableElement
It should be noted that previews in Product Advisor (Product Comparison, Product Explorer and Sales Assistant previews) point to a sample JSP, and hence cannot show the images of a specific store as the image paths are relative. If one has to display the images, they need to point to a JSP in the store specific folder, which would be typically a customised version of pe51.jsp or pc51.jsp or sa51.jsp. The URL should be modified to point to the store specific JSP in the prompt which comes up when preview is clicked. This method displays the images as it will be having the images corresponding to that store available.
To address this issue, a prompt dialog is given before preview, so that the URL can be modified accordingly.
Related concepts
Related reference
Sample: Product Advisor JSP files