SlideShare a Scribd company logo
Create a simple rating/review system with a Drupal 6 installation and the latest stable versions of the following modules:

•    Fivestar
•    Voting API
•    CCK

This tutorial was written based on testing performed in the following enviroment:

•    Windows Vista Home Edition
•    Apache 2.2.8, PHP 5.2.6, MySQL 5.0.51a
•    Drupal 6.10
•    CCK 6.x-2.2
•    Fivestar 6.x-1.13
•    Voting API 6.x-2.0-rc2

This tutorial will use two content types created using CCK - "Product" and "Review". "Product" is the target node type, or in
other words, the node type that is being reviewed by users. Users can submit reviews of Products's using the "Review" node
type. The "Review" node type will contain the fivestar cck fields that users will use to rate the Product nodes. A single rating
review system and a multi-axis review system will be demonstrated. The multi-axis review system will consist of reviews that
allows users rate a Product in more than one category (e.g. Reliability and Value instead of a single Overall Rating).

Single rating review system:
Step 1: Create the Product node type using CCK and create a Product

Go to admin/content/types/add and create a new node type called "Product" (no quotations). IMPORTANT: CHECK THE
"ENABLE FIVESTAR RATING" BOX UNDER THE "FIVESTAR RATINGS" FIELDSET. Votes made by the Review content type
will not be calculated unless this box is checked. Then select "Hidden" under "Teaser Display" and "Full node display". This will
hide the rating widget on the Product nodes (we don't want the widget on the product nodes, we want it on the Review nodes).
Save this content type and create a Product node titled "Product A". Note the url of this node as you will need to come back to it
later.

Step 2: Create the Review node type with a single rating field using CCK and create a Review node

Go back to admin/content/types/add and create a new node type called "Review" (no quotations). Save the node type and then
click "manage fields" for the Review node type. Add a new field with the label "Select the product you wish to review", field
name "product_reference", field type "Node reference", and form element "Select list". Under the global settings, make the field
required and check "Product" under "Content types that can be referenced". Save the field and add another field with the label
"Overall Rating", field name "overall_rating", field type "Fivestar Rating", and form element "Stars". Under Review settings,
uncheck "Allow user to clear value". Under Global Settings, check the "Required" box and under "Voting target", select the
node reference field "field_product_reference". PHP CODE IS NOT NEEDED -- LEAVE BLANK. VOTING AXIS IS NOT
NEEDED FOR SINGLE REVIEW SYSTEM -- LEAVE BLANK. Save the field settings.

Now you can create a Review, enter a title, enter body text (optional), give it a rating, and select "Product A" under "Select the
product you wish to review". Submit the review.

Step 3 : Create custom node template file

Go to your theme folder. Copy node.tpl.php and rename it node-product.tpl.php. Insert the following code in the template file to
display the average of the rating:

<?php
$current_rating = votingapi_select_results(array('content_id' => $node->nid, 'function' =>
'average'));
print '<div><strong>Rating:</strong>';
print theme('fivestar_static', $current_rating[0]['value'], '5'); //this is for 5 stars,
enter 10 (or whatever) instead as appropriate
print '</div>';
?>

The position of this code in the template file will determine where the rating widget(s) is/are displayed on the Product node
pages.

After you have inserted the display code into node-produt.tpl.php, visit the Product A node. You should now see the rating
widget(s). In order for the widget to display an average of ratings, you must submit multiple Reviews. By design, a second
rating by a user wil overwrite the initial rating that user submitted. In other words, you must submit Reviews by at least two
different users to see an average calculated on the Product node pages. After you submit multiple Reviews, you can verify that
the average is being calculated and displayed.

Multi-axis Rating System:
Step 1: Create the Product node type using CCK and create a Product

Go to admin/content/types/add and create a new node type called "Product" (no quotations). IMPORTANT: CHECK THE
"ENABLE FIVESTAR RATING" BOX UNDER THE "FIVESTAR RATINGS" FIELDSET. Votes made by the Review content type
will not be calculated unless this box is checked. Then select "Hidden" under "Teaser Display" and "Full node display". This will
hide the rating widget on the Product nodes (we don't want the widget on the product nodes, we want it on the Review nodes).
Save this content type and create a Product node titled "Product A". Note the url of this node as you will need to come back to it
later.

Step 2 (Multi-axis Rating System): Create the Review node type with multiple rating fields using CCK and create a Review node

Go back to admin/content/types/add and create a new node type called "Review" (no quotations). Save the node type and then
click "manage fields" for the Review node type. Add a new field with the label "Select the product you wish to review", field
name "product_reference", field type "Node reference", and form element "Select list". Under the global settings, make the field
required and check "Product" under "Content types that can be referenced". Save the field and add another field with the label
"Reliablity Rating", field name "reliability", field type "Fivestar Rating", and form element "Stars". Under Review settings,
uncheck "Allow user to clear value". Under Global Settings, check the "Required" box and under "Voting target", select the
node reference field "field_product_reference". PHP CODE IS NOT NEEDED -- LEAVE BLANK. Under voting axis, enter
"reliability". Save the field settings. Enter a second rating field with label "Value Rating", field name "value", field type "Fivestar
Rating", and form element "Stars". Use the same field settings as the "Reliability Rating" field, but under voting axis, enter
"value". Save the field settings.

Step 3 (Multi-axis Rating System): Create custom node template file

Go to your theme folder. Copy node.tpl.php and rename it node-product.tpl.php. Insert the following code in the template file to
display the average of the rating:

<?php
$reliability_rating = votingapi_select_results(array('content_id' => $node->nid, 'tag'
=>'reliability', 'function' => 'average'));
print '<div><strong>Reliability Rating:</strong>';
print theme('fivestar_static', $reliability_rating[0]['value'], '5');
print '</div>';
$value_rating = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'value',
'function' => 'average'));
print '<div><strong>Value Rating:</strong>';
print theme('fivestar_static', $value_rating[0]['value'], '5');
print '</div>';
?>


The position of this code in the template file will determine where the rating widget(s) is/are displayed on the Product node
pages.

After you have inserted the display code into node-produt.tpl.php, visit the Product A node. You should now see the rating
widget(s). In order for the widget to display an average of ratings, you must submit multiple Reviews. By design, a second
rating by a user wil overwrite the initial rating that user submitted. In other words, you must submit Reviews by at least two
different users to see an average calculated on the Product node pages. After you submit multiple Reviews, you can verify that
the average is being calculated and displayed.

Displaying Fivestar Multi-axis Review Ratings with Views 2.x

This tutorial was using Drupal 6.11 and Fivestar 6.x-1.15.

After setting up a mult-axis review system using the above instructions, the next logical step would be to display the results
using a view. Here are the instructions for building such a view.

Step 1: Have a multi-axis review system in place with at least 1 reviewable node and 2 reviews submitted for that node.

Following the previously mentioned tutorial, build a review system consisting of a "Product" node type and "Review" node type.
"Product" is the node type that will be reviewed by the "Review" node type. "Review" node type will allow users to create
reviews of Products and rate the products on multiple axes.

Once the review system is in place, make sure you have at least 1 "Product" node (call it "Product A") and 2 "Review" nodes
(call them Review 1 and Review 2) created by 2 different users that rate the "Product A" node.

Step 2: Build a view that displays all "Product" nodes and the average of each rating given to each "Product" node. Sort views
by highest rating in different categories.

Go to admin/build/views and create a new view. Give it a View name of "Products" and a View type of "Node". Add a Page
display and make the title of the page "Products and Product Ratings". Make the Style of the page a "Table" and make the Path
of the page "products". Add a field of type "Node: Title". Add a filter of type "Node: Type" and select "Is one of" and check the
node type "Product".

Now add a Relationship to the view of the type "Node: Voting results". In the previously mentioned tutorial, the axes that were
used were "reliability" and "value". Staying consistent, give the relationship a label of "Reliability Results". Make the Value type
"Percent", the Vote tag "reliability", and the Aggregation function "Average". Add a secon Relationship of type "Node: Voting
results" - label it "Value Results", make the Value type "Percent", Vote tage "value", and Aggregation function "Average".

Now add a field of type "Voting API results: Value". Make the Appearance "Fivestar Stars (display only), the Relationship
"Reliability Results" and the Label" "Average Reliability Rating". Add another field of the type "Voting API results: Value". Make
the Appearance "Fivestar Stars (display only), the Relationship "Value Results" and the Label "Average Value Rating".
You should now have a view that displays the Product name and the aggregate averages for each rating axis (Reliability and
Value). Now a sort can be added to this view. Add a Sort Criteria of type "Voting API Results: Value". Make the Relationship
"Reliability Rating" and sort "Descending" to go from highest values to lowest values. This will sort the Products from highest
"Reliability Rating" to lowest "Reliability Rating". This view can then be cloned and edited so that the products are sorted by
different rating axes (sort by Value rating for instance).

More Related Content

What's hot

introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
Ravindra K
 
Visual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICVisual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TIC
Mauricio Correa
 
Apps 11i10 Forms Personalization
Apps 11i10 Forms PersonalizationApps 11i10 Forms Personalization
Apps 11i10 Forms PersonalizationHossam El-Faxe
 
Lab Management with TFS 2010
Lab Management with TFS 2010Lab Management with TFS 2010
Lab Management with TFS 2010
Ed Blankenship
 
Lab 2: Creating views at the project level in the web client
Lab 2: Creating views at the project level in the web clientLab 2: Creating views at the project level in the web client
Lab 2: Creating views at the project level in the web client
IBM Rational software
 
Lab 3: Optional: Creating views at the module level (web client)
Lab 3: Optional: Creating views at the module level (web client)Lab 3: Optional: Creating views at the module level (web client)
Lab 3: Optional: Creating views at the module level (web client)
IBM Rational software
 
Administrating Req Pro
Administrating Req ProAdministrating Req Pro
Administrating Req Pro
Leslie Munday
 
Lab 3: Commenting on artifacts and customizing dashboards
Lab 3: Commenting on artifacts and customizing dashboardsLab 3: Commenting on artifacts and customizing dashboards
Lab 3: Commenting on artifacts and customizing dashboards
IBM Rational software
 
Forms personalization
Forms personalizationForms personalization
Forms personalization
Rajiv reddy
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 
Hands-On Lab Data Mining - SQL Server
Hands-On Lab Data Mining - SQL ServerHands-On Lab Data Mining - SQL Server
Hands-On Lab Data Mining - SQL Server
Serra Laercio
 

What's hot (12)

introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
Visual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TICVisual Studio 2012 Course Blackboard TIC
Visual Studio 2012 Course Blackboard TIC
 
Apps 11i10 Forms Personalization
Apps 11i10 Forms PersonalizationApps 11i10 Forms Personalization
Apps 11i10 Forms Personalization
 
Lab Management with TFS 2010
Lab Management with TFS 2010Lab Management with TFS 2010
Lab Management with TFS 2010
 
Lab 2: Creating views at the project level in the web client
Lab 2: Creating views at the project level in the web clientLab 2: Creating views at the project level in the web client
Lab 2: Creating views at the project level in the web client
 
Lab 3: Optional: Creating views at the module level (web client)
Lab 3: Optional: Creating views at the module level (web client)Lab 3: Optional: Creating views at the module level (web client)
Lab 3: Optional: Creating views at the module level (web client)
 
Administrating Req Pro
Administrating Req ProAdministrating Req Pro
Administrating Req Pro
 
Lab 3: Commenting on artifacts and customizing dashboards
Lab 3: Commenting on artifacts and customizing dashboardsLab 3: Commenting on artifacts and customizing dashboards
Lab 3: Commenting on artifacts and customizing dashboards
 
Forms personalization
Forms personalizationForms personalization
Forms personalization
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
 
Oaf personaliztion examples
Oaf personaliztion examplesOaf personaliztion examples
Oaf personaliztion examples
 
Hands-On Lab Data Mining - SQL Server
Hands-On Lab Data Mining - SQL ServerHands-On Lab Data Mining - SQL Server
Hands-On Lab Data Mining - SQL Server
 

Viewers also liked

CorelDraw%20Tutorial%203
CorelDraw%20Tutorial%203CorelDraw%20Tutorial%203
CorelDraw%20Tutorial%203tutorialsruby
 
bluejay_basic_tutorial
bluejay_basic_tutorialbluejay_basic_tutorial
bluejay_basic_tutorialtutorialsruby
 
advanced%20corel%20draw
advanced%20corel%20drawadvanced%20corel%20draw
advanced%20corel%20drawtutorialsruby
 
CC200-20ProductIntroductionEU
CC200-20ProductIntroductionEUCC200-20ProductIntroductionEU
CC200-20ProductIntroductionEUtutorialsruby
 
corel draw-x4-untuk-desain-sampul-buku-bab-3
corel draw-x4-untuk-desain-sampul-buku-bab-3corel draw-x4-untuk-desain-sampul-buku-bab-3
corel draw-x4-untuk-desain-sampul-buku-bab-3task groub campus
 

Viewers also liked (8)

CorelDraw%20Tutorial%203
CorelDraw%20Tutorial%203CorelDraw%20Tutorial%203
CorelDraw%20Tutorial%203
 
bluejay_basic_tutorial
bluejay_basic_tutorialbluejay_basic_tutorial
bluejay_basic_tutorial
 
AlignDistribute
AlignDistributeAlignDistribute
AlignDistribute
 
advanced%20corel%20draw
advanced%20corel%20drawadvanced%20corel%20draw
advanced%20corel%20draw
 
CC200-20ProductIntroductionEU
CC200-20ProductIntroductionEUCC200-20ProductIntroductionEU
CC200-20ProductIntroductionEU
 
corel draw-x4-untuk-desain-sampul-buku-bab-3
corel draw-x4-untuk-desain-sampul-buku-bab-3corel draw-x4-untuk-desain-sampul-buku-bab-3
corel draw-x4-untuk-desain-sampul-buku-bab-3
 
tutorial
tutorialtutorial
tutorial
 
Totorial Coreldraw_5
Totorial Coreldraw_5Totorial Coreldraw_5
Totorial Coreldraw_5
 

Similar to Tutorial%20fivestar%20cck%20views

Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardAmit Sharma
 
Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardAmit Sharma
 
Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardAmit Sharma
 
Bricano Presentation
Bricano PresentationBricano Presentation
Bricano PresentationDinesh Pant
 
01 startoff angularjs
01 startoff angularjs01 startoff angularjs
01 startoff angularjs
Erhwen Kuo
 
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoAgile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoMoldova ICT Summit
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnet
rainynovember12
 
Introduction To ReqPro
Introduction To ReqProIntroduction To ReqPro
Introduction To ReqPro
Leslie Munday
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
Senturus
 
Mvc summary
Mvc summaryMvc summary
Mvc summary
Muhammad Younis
 
WAC Widget Upload Process
WAC Widget Upload ProcessWAC Widget Upload Process
WAC Widget Upload Process
wacapps
 
Bdd with Cucumber and Mocha
Bdd with Cucumber and MochaBdd with Cucumber and Mocha
Bdd with Cucumber and Mocha
Atish Narlawar
 
Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Software GmbH
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 
Balancing UX Consistency and Developer Productivity in a Design System
Balancing UX Consistency and Developer Productivity in a Design SystemBalancing UX Consistency and Developer Productivity in a Design System
Balancing UX Consistency and Developer Productivity in a Design System
uxpin
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
Malla Reddy University
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
Alfa Gama Omega
 
New Products Web Site
New Products Web SiteNew Products Web Site
New Products Web Sitegenegw
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
CiaranMcNulty
 

Similar to Tutorial%20fivestar%20cck%20views (20)

Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboard
 
Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboard
 
Obiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboardObiee11g building-brand-analysis-dashboard
Obiee11g building-brand-analysis-dashboard
 
Bricano Presentation
Bricano PresentationBricano Presentation
Bricano Presentation
 
01 startoff angularjs
01 startoff angularjs01 startoff angularjs
01 startoff angularjs
 
Agile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai ShevchenkoAgile methodologies based on BDD and CI by Nikolai Shevchenko
Agile methodologies based on BDD and CI by Nikolai Shevchenko
 
Model View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In AspnetModel View Presenter (MVP) In Aspnet
Model View Presenter (MVP) In Aspnet
 
Introduction To ReqPro
Introduction To ReqProIntroduction To ReqPro
Introduction To ReqPro
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
 
Mvc summary
Mvc summaryMvc summary
Mvc summary
 
WAC Widget Upload Process
WAC Widget Upload ProcessWAC Widget Upload Process
WAC Widget Upload Process
 
Building richwebapplicationsusingasp
Building richwebapplicationsusingaspBuilding richwebapplicationsusingasp
Building richwebapplicationsusingasp
 
Bdd with Cucumber and Mocha
Bdd with Cucumber and MochaBdd with Cucumber and Mocha
Bdd with Cucumber and Mocha
 
Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019Intland Academy: Requirements Management Training Session | 19 Sep 2019
Intland Academy: Requirements Management Training Session | 19 Sep 2019
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Balancing UX Consistency and Developer Productivity in a Design System
Balancing UX Consistency and Developer Productivity in a Design SystemBalancing UX Consistency and Developer Productivity in a Design System
Balancing UX Consistency and Developer Productivity in a Design System
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
 
New Products Web Site
New Products Web SiteNew Products Web Site
New Products Web Site
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
 

More from tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

More from tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

Tutorial%20fivestar%20cck%20views

  • 1. Create a simple rating/review system with a Drupal 6 installation and the latest stable versions of the following modules: • Fivestar • Voting API • CCK This tutorial was written based on testing performed in the following enviroment: • Windows Vista Home Edition • Apache 2.2.8, PHP 5.2.6, MySQL 5.0.51a • Drupal 6.10 • CCK 6.x-2.2 • Fivestar 6.x-1.13 • Voting API 6.x-2.0-rc2 This tutorial will use two content types created using CCK - "Product" and "Review". "Product" is the target node type, or in other words, the node type that is being reviewed by users. Users can submit reviews of Products's using the "Review" node type. The "Review" node type will contain the fivestar cck fields that users will use to rate the Product nodes. A single rating review system and a multi-axis review system will be demonstrated. The multi-axis review system will consist of reviews that allows users rate a Product in more than one category (e.g. Reliability and Value instead of a single Overall Rating). Single rating review system: Step 1: Create the Product node type using CCK and create a Product Go to admin/content/types/add and create a new node type called "Product" (no quotations). IMPORTANT: CHECK THE "ENABLE FIVESTAR RATING" BOX UNDER THE "FIVESTAR RATINGS" FIELDSET. Votes made by the Review content type will not be calculated unless this box is checked. Then select "Hidden" under "Teaser Display" and "Full node display". This will hide the rating widget on the Product nodes (we don't want the widget on the product nodes, we want it on the Review nodes). Save this content type and create a Product node titled "Product A". Note the url of this node as you will need to come back to it later. Step 2: Create the Review node type with a single rating field using CCK and create a Review node Go back to admin/content/types/add and create a new node type called "Review" (no quotations). Save the node type and then click "manage fields" for the Review node type. Add a new field with the label "Select the product you wish to review", field name "product_reference", field type "Node reference", and form element "Select list". Under the global settings, make the field required and check "Product" under "Content types that can be referenced". Save the field and add another field with the label "Overall Rating", field name "overall_rating", field type "Fivestar Rating", and form element "Stars". Under Review settings, uncheck "Allow user to clear value". Under Global Settings, check the "Required" box and under "Voting target", select the node reference field "field_product_reference". PHP CODE IS NOT NEEDED -- LEAVE BLANK. VOTING AXIS IS NOT NEEDED FOR SINGLE REVIEW SYSTEM -- LEAVE BLANK. Save the field settings. Now you can create a Review, enter a title, enter body text (optional), give it a rating, and select "Product A" under "Select the product you wish to review". Submit the review. Step 3 : Create custom node template file Go to your theme folder. Copy node.tpl.php and rename it node-product.tpl.php. Insert the following code in the template file to display the average of the rating: <?php $current_rating = votingapi_select_results(array('content_id' => $node->nid, 'function' => 'average')); print '<div><strong>Rating:</strong>'; print theme('fivestar_static', $current_rating[0]['value'], '5'); //this is for 5 stars, enter 10 (or whatever) instead as appropriate print '</div>'; ?> The position of this code in the template file will determine where the rating widget(s) is/are displayed on the Product node pages. After you have inserted the display code into node-produt.tpl.php, visit the Product A node. You should now see the rating widget(s). In order for the widget to display an average of ratings, you must submit multiple Reviews. By design, a second rating by a user wil overwrite the initial rating that user submitted. In other words, you must submit Reviews by at least two different users to see an average calculated on the Product node pages. After you submit multiple Reviews, you can verify that the average is being calculated and displayed. Multi-axis Rating System: Step 1: Create the Product node type using CCK and create a Product Go to admin/content/types/add and create a new node type called "Product" (no quotations). IMPORTANT: CHECK THE "ENABLE FIVESTAR RATING" BOX UNDER THE "FIVESTAR RATINGS" FIELDSET. Votes made by the Review content type will not be calculated unless this box is checked. Then select "Hidden" under "Teaser Display" and "Full node display". This will hide the rating widget on the Product nodes (we don't want the widget on the product nodes, we want it on the Review nodes).
  • 2. Save this content type and create a Product node titled "Product A". Note the url of this node as you will need to come back to it later. Step 2 (Multi-axis Rating System): Create the Review node type with multiple rating fields using CCK and create a Review node Go back to admin/content/types/add and create a new node type called "Review" (no quotations). Save the node type and then click "manage fields" for the Review node type. Add a new field with the label "Select the product you wish to review", field name "product_reference", field type "Node reference", and form element "Select list". Under the global settings, make the field required and check "Product" under "Content types that can be referenced". Save the field and add another field with the label "Reliablity Rating", field name "reliability", field type "Fivestar Rating", and form element "Stars". Under Review settings, uncheck "Allow user to clear value". Under Global Settings, check the "Required" box and under "Voting target", select the node reference field "field_product_reference". PHP CODE IS NOT NEEDED -- LEAVE BLANK. Under voting axis, enter "reliability". Save the field settings. Enter a second rating field with label "Value Rating", field name "value", field type "Fivestar Rating", and form element "Stars". Use the same field settings as the "Reliability Rating" field, but under voting axis, enter "value". Save the field settings. Step 3 (Multi-axis Rating System): Create custom node template file Go to your theme folder. Copy node.tpl.php and rename it node-product.tpl.php. Insert the following code in the template file to display the average of the rating: <?php $reliability_rating = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'reliability', 'function' => 'average')); print '<div><strong>Reliability Rating:</strong>'; print theme('fivestar_static', $reliability_rating[0]['value'], '5'); print '</div>'; $value_rating = votingapi_select_results(array('content_id' => $node->nid, 'tag' =>'value', 'function' => 'average')); print '<div><strong>Value Rating:</strong>'; print theme('fivestar_static', $value_rating[0]['value'], '5'); print '</div>'; ?> The position of this code in the template file will determine where the rating widget(s) is/are displayed on the Product node pages. After you have inserted the display code into node-produt.tpl.php, visit the Product A node. You should now see the rating widget(s). In order for the widget to display an average of ratings, you must submit multiple Reviews. By design, a second rating by a user wil overwrite the initial rating that user submitted. In other words, you must submit Reviews by at least two different users to see an average calculated on the Product node pages. After you submit multiple Reviews, you can verify that the average is being calculated and displayed. Displaying Fivestar Multi-axis Review Ratings with Views 2.x This tutorial was using Drupal 6.11 and Fivestar 6.x-1.15. After setting up a mult-axis review system using the above instructions, the next logical step would be to display the results using a view. Here are the instructions for building such a view. Step 1: Have a multi-axis review system in place with at least 1 reviewable node and 2 reviews submitted for that node. Following the previously mentioned tutorial, build a review system consisting of a "Product" node type and "Review" node type. "Product" is the node type that will be reviewed by the "Review" node type. "Review" node type will allow users to create reviews of Products and rate the products on multiple axes. Once the review system is in place, make sure you have at least 1 "Product" node (call it "Product A") and 2 "Review" nodes (call them Review 1 and Review 2) created by 2 different users that rate the "Product A" node. Step 2: Build a view that displays all "Product" nodes and the average of each rating given to each "Product" node. Sort views by highest rating in different categories. Go to admin/build/views and create a new view. Give it a View name of "Products" and a View type of "Node". Add a Page display and make the title of the page "Products and Product Ratings". Make the Style of the page a "Table" and make the Path of the page "products". Add a field of type "Node: Title". Add a filter of type "Node: Type" and select "Is one of" and check the node type "Product". Now add a Relationship to the view of the type "Node: Voting results". In the previously mentioned tutorial, the axes that were used were "reliability" and "value". Staying consistent, give the relationship a label of "Reliability Results". Make the Value type "Percent", the Vote tag "reliability", and the Aggregation function "Average". Add a secon Relationship of type "Node: Voting results" - label it "Value Results", make the Value type "Percent", Vote tage "value", and Aggregation function "Average". Now add a field of type "Voting API results: Value". Make the Appearance "Fivestar Stars (display only), the Relationship "Reliability Results" and the Label" "Average Reliability Rating". Add another field of the type "Voting API results: Value". Make the Appearance "Fivestar Stars (display only), the Relationship "Value Results" and the Label "Average Value Rating".
  • 3. You should now have a view that displays the Product name and the aggregate averages for each rating axis (Reliability and Value). Now a sort can be added to this view. Add a Sort Criteria of type "Voting API Results: Value". Make the Relationship "Reliability Rating" and sort "Descending" to go from highest values to lowest values. This will sort the Products from highest "Reliability Rating" to lowest "Reliability Rating". This view can then be cloned and edited so that the products are sorted by different rating axes (sort by Value rating for instance).