Product Reviews
Last updated
Last updated
About
Team© 2024 Sylius. All Rights Reserved
Product Reviews are a marketing tool that lets your customers give opinions about the products they buy in your shop. They have a rating
and comment
.
The rating of a product review is required and must be between 1 and 5.
When you look inside the CoreBundle/Resources/config/app/state_machine/sylius_product_review.yml
you will find out that a Review can have 3 different states:
new
,
accepted
,
rejected
There are only two possible transitions: accept
(from new
to accepted
) and reject
(from new
to rejected
).
When a review is accepted the average rating of a product is updated.
The average rating is updated by the AverageRatingUpdater service.
It wraps the AverageRatingCalculator and uses it inside the updateFromReview
method.
Create a new review using a factory:
Fill in the content of your review.
Then get a customer from the repository, which you would like to make an author of this review.
Remember to set the object that is the subject of your review and then add the review to the repository.