ZenMagick 0.9.10


zenmagick.store.shared.services\ZMReviews
services\ZMReviews.php at line 33

Class ZMReviews

ZMObject
└─ZMReviews

public class ZMReviews
extends ZMObject

Reviews.

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct()

Create new instance.

ZMReview

createReview(ZMReview review, mixed account, int languageId, ZMAccount author)

Create a new review.

array

getAllReviews(int languageId)

Get all published reviews.

float

getAverageRatingForProductId(int productId, int languageId)

Get the average rating for the given product id.

array

getRandomReviews(int languageId, int productId, int max)

Get a random review.

int

getReviewCount(int productId, int languageId)

Get the number of reviews for the given product (id).

ZMReview

getReviewForId(int reviewId, int languageId)

Get the review for the given review id.

array

getReviewsForProductId(int productId, int languageId)

Get all reviews for the given product id.

static void

instance()

Get instance.

void

updateViewCount(int reviewId)

Update the view count for the given review id.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

services\ZMReviews.php at line 38

__construct

public void __construct()

Create new instance.


services\ZMReviews.php at line 241

createReview

public ZMReview createReview(ZMReview review, mixed account, int languageId, ZMAccount author)

Create a new review.

Parameters:
review - The new review.
author - The review author.
languageId - The language for this review.
Returns:
The inserted review (incl. the new id).

services\ZMReviews.php at line 182

getAllReviews

public array getAllReviews(int languageId)

Get all published reviews.

Parameters:
languageId - Language id.
Returns:
List of ZMReview instances.

services\ZMReviews.php at line 140

getAverageRatingForProductId

public float getAverageRatingForProductId(int productId, int languageId)

Get the average rating for the given product id.

Parameters:
productId - The product id.
languageId - Language id.
Returns:
The average rating or null if no ratnig exists.

services\ZMReviews.php at line 84

getRandomReviews

public array getRandomReviews(int languageId, int productId, int max)

Get a random review.

Parameters:
languageId - Language id.
productId - Optional productId to limit reviews to one product; default is null.
max - Optional result limit; default is null to use the setting .
Returns:
List of ZMReview instances.

services\ZMReviews.php at line 64

getReviewCount

public int getReviewCount(int productId, int languageId)

Get the number of reviews for the given product (id).

Parameters:
productId - The product id.
languageId - Language id.
Returns:
The number of published reviews for the product.

services\ZMReviews.php at line 205

getReviewForId

public ZMReview getReviewForId(int reviewId, int languageId)

Get the review for the given review id.

Parameters:
reviewId - The id of the review to load.
languageId - Language id.
Returns:
A ZMReview instance or null.

services\ZMReviews.php at line 159

getReviewsForProductId

public array getReviewsForProductId(int productId, int languageId)

Get all reviews for the given product id.

Parameters:
productId - The product id.
languageId - Language id.
Returns:
List of ZMReview instances.

services\ZMReviews.php at line 52

instance

public static void instance()

Get instance.


services\ZMReviews.php at line 226

updateViewCount

public void updateViewCount(int reviewId)

Update the view count for the given review id.

Parameters:
reviewId - The id of the review.

ZenMagick 0.9.10