[WIP] [Review] SyliusReviewBundle#3300
Conversation
There was a problem hiding this comment.
None of migration files have license block ;)
There was a problem hiding this comment.
All right. Anyway, after merging #3326 the dates should be set to be after 08.09.2015
|
@Zales0123 Great job, this bundle is going to be very useful since it's generic, let alone Disqus and Facebook Comments integration in future. (I wish I can find free time to help in that) Since social media channel is very favorable to shop owners (It allows them to create a loyal customer network through that), I hope this is a good start to make Sylius both technically awesome and a powerful toolset in e-commerce marketing sense. Congrats ;) |
|
@aramalipoor Thank you very much for you appreciation! This idea with fb comments integration is pretty cool and definitely should be considered in nearest/further future. |
bc21b3d to
43c464a
Compare
49e9600 to
0e26b07
Compare
There was a problem hiding this comment.
Why we need this?
There was a problem hiding this comment.
This variable is incremented in private addReviewRatingIfAccepted function - it's done this way to avoid passing it as reference.
There was a problem hiding this comment.
The calculator shouldn't have state, so it shouldn't have any class field. This should be removed.
Split bundle to bundle and component. Removed unnecessary classes, due to logic changes. General code refactoring.
Calculate average rating on review confirmation, not creation.
Split configurations into Review-, Product- and CoreBundle parts
Also some general and CS fixes.
Also some changes/fixes in templates and crucial changes in review creation.
10ba6ea to
491ea1b
Compare
There was a problem hiding this comment.
What about something like:
$reviewsNumber = 0;
$sum = 0.0;
$reviews = $reviewable->getReviews()->filter(function (ReviewInterface $review) use ($sum, $reviewsNumber) {
if (ReviewInterface::STATUS_ACCEPTED === $review->getStatus()) {
++$reviewsNumber;
$sum += $review->getRating();
return $review;
}
});
if ($reviews->isEmpty()) {
return 0;
}
return $sum / $reviewNumber;There was a problem hiding this comment.
I think we can use foreach instead of filter and it will do the same job ;)
491ea1b to
bdac5d6
Compare
Also some minor PR review fixes
bdac5d6 to
71ccbc3
Compare
|
Closing in favor of #3980. |
Initial implementation of SyliusReviewBundle, which allows to easily manage review system. It's based on #431. "Reviewable" and "Reviewer" classes can be configured under
sylius_reviewtag:Reviews can be written by customers and guests on the product page. Newly created review has state
newand can beconfirmedorrejectedby administrator. After confirming, it's product has average rating calculated. There are 3 possible behaviors while review creation:Reviews can be also created in administration panel, with choosing product and author.
There are still some things that have to be changed to make it working perfectly:
Some ideas for future improvements:
I will be thankful for some review, cause I'm pretty sure there are some part where my code can be improved ;)