HowTo: Configure product reviews

Edit on GitHub

Configure the maximum rating

To change the maximum allowed rating, alter the Client configuration by extending the \Spryker\Client\ProductReview\ProductReviewConfig class in your project directory.

Override the getMaximumRating method to return the desired selectable maximum rating value.

Example of client config extension:

<?php
            namespace Pyz\Client\ProductReview;

            use Spryker\Client\ProductReview\ProductReviewConfig as ProductReviewProductReviewConfig;

            class ProductReviewConfig extends ProductReviewProductReviewConfig
            {

                /**
                 * @return int
                 */
                public function getMaximumRating()
                {
                    return 10;
                }

            }

Configure the number of reviews displayed per page

  1. To change the maximum number of reviews displayed per page, alter the Client configuration by extending the \Spryker\Client\ProductReview\ProductReviewConfig class in your project directory.

  2. Override the PAGINATION_DEFAULT_ITEMS_PER_PAGE and PAGINATION_VALID_ITEMS_PER_PAGE constants to the desired number of reviews to be displayed per page.

An example of the client config extension:

<?php
            namespace Pyz\Client\ProductReview;

            use Spryker\Client\ProductReview\ProductReviewConfig as ProductReviewProductReviewConfig;

            class ProductReviewConfig extends ProductReviewProductReviewConfig
            {

                const PAGINATION_DEFAULT_ITEMS_PER_PAGE = 5;
                const PAGINATION_VALID_ITEMS_PER_PAGE = [
                    5,
                ];

            }