$wsProductRating module, you can load, check, and display product ratings in the frontend.
Product ratings are an important element for purchasing decisions. They show customers the experiences of other buyers and increase trust in products.
Module overview
Example / excerpt of$wsProductRating
"ƒ()" denotes a function.
Methods overview
Templates
Product ratings are typically displayed on the product detail page (product.htm). They can also be included on category pages or in the order history to prompt customers to leave a rating.Variables
No variables are available for$wsProductRating.
Methods
$wsProductRating.checkRatingExistence()
Checks whether a rating already exists for a product in connection with an order. Signature$wsProductRating.checkRatingExistence(productId, orderId)
Return valuebool - true if a rating exists, otherwise false.
Parameters
Example that checks whether a rating exists.
$wsProductRating.loadAllProductRatings()
Loads all ratings of a product. Signature$wsProductRating.loadAllProductRatings(productId)
Return valuearray - List with all ratings of the product.
Parameters
Example that loads all ratings of a product.
$wsProductRating.loadRatingStatistics()
Loads statistics for the ratings of a product. Signature$wsProductRating.loadRatingStatistics(productId)
Return valuemap - Map with rating statistics (e.g. average, count).
Parameters
Example that loads the statistics of a product.
$wsProductRating.loadSingleRating()
Loads a single rating based on product and order ID. Signature$wsProductRating.loadSingleRating(productId, orderId)
Return valuemap - Map with the rating data.
Parameters
Example that loads a single rating.
$wsProductRating.loadLatestRatingForAccount()
Loads the latest rating of the currently logged-in customer. Signature$wsProductRating.loadLatestRatingForAccount()
Return valuemap - Map with the rating data.
Example that loads the customer’s latest rating.
$wsProductRating.loadRatingByAccount()
Loads a product rating of the currently logged-in customer. Signature$wsProductRating.loadRatingByAccount(productId)
Return valuemap - Map with the customer’s rating data.
Parameters
Example that loads the customer’s rating for a product.
Actions
No actions are available for$wsProductRating.
