Comparative Ratings |
In addition to the ability to put up product rating forms and displays on a
product by product basis, ViewsFlash can also create comparison tables automatically
and learn product information dynamically.
As with basic ratings, the product ID will be used as the poll ID. In addition, you will need a way to group products to be compared. For example, all 2000 model European convertibles; these will be grouped automatically into a" place". Then you can make comparisons between all the products in a group in a single call to ViewsFlash.
1. Follow all the steps in Ratings, construct a simple system without comparative rankings, and make sure it works.
2. Add to your fetchpoll and fetchresults commands the parameter "&spot=GGGG", where GGGG is the ID of the product group they belong to. ViewsFlash will automatically create a place for them, copying the settings from the place where the "likeid" poll belongs.
3. To fetch the comparative results table, create a template as defined below,
and compose a page that includes the command:
/servlet/viewsflash?cmd=fetchtable&... (other parameters)
The additional parameters are:
spot | name of the product category | required |
templatefile | name of response page template, relative to the viewsflash web server root. This is not the name of a style template! | required |
rank | name of field to rank by | optional |
max | maximum number of items to display | optional; default is 10 |
method | what to rank by; either average or count | optional; default is average |
minvote | minimum number of votes required to display | optional; default is 1 |
order | sorting order; can be top or bottom | optional; default is top (to bottom) |
Constructing a ratings table template.
Create a response page template and surround it with [/rankedpolls] and [/endrankedpolls] tags. Note that this is not a Response Style template; you will typically only use tags the "avg" and "count" tags. Store this template in the viewsflash web server root directory structure.
Additional parameters
The example on the Cogix site includes elements such as Price and the name product name. Where do they come from? ViewsFlash can learn these as it goes along. Here's what you do:
1. Use the fields "param0" through "param9" to hold properties of each item, such as its name and its price.
2. In both the cmd=fetchpoll and cmd=fetchresults calls, include the appropriate
characteristics. For example:
cmd=getpoll&pollid=Racing!Carrera&likepoll=Convertibles¶m0=Porsche
911E Carrera Convertible¶m1=90000
As ViewsFlash serves voting forms and ratings results tables, it will learn the names and prices of the rated items automatically.
3. Use the param0 through param9 field names in the ratings table templates.
Here's a simplified version of the template used in the Ratings example, using param0 for the product name and param1 for its price. Overall, Ease, Quality, Ease, Durability and Value are the names of the Questions that every ratings form includes. The "avg,1" notation means include one decimal place in the average score displayed. Because ratings are between 0 and 5 stars, files named 0star.gif through 5star.gif are served.
[/rankedpolls]
<tr><td>[/param0]</a> </td>
<td align="right">$[/param1]</td>
<td align="center">[/Overall,count]</td>
<td ><img src="/viewsflash/[/Ease,avg,0]star.gif"></td>
<td > [/Overall,avg,1]</td>
<td > [/Quality,avg,1] </td>
<td > [/Ease,avg,1] </td>
<td > [/Durability,avg,1] </td>
<td > [/Value,avg,1] </td>
</tr>
[/endrankedpolls]
Cogix Client services is available to assist with all phases of creating a comprehensive Ratings system.