LemonStand Documentation

shop:onExtendProductReviewModel event

The shop:onExtendProductReviewModel event allows to add new columns to the product review model. Before you add columns to the model, your module should add corresponding columns to the database (the shop_product_reviews table). You can learn about updating the database structure from the Creating and updating database tables article.

The event handler should accept a single parameter - the product review object (Shop_ProductReview class). Example:

public function subscribeEvents()
{
	Backend::$events->addEvent('shop:onExtendProductReviewModel', $this, 'extend_product_review_model');
	Backend::$events->addEvent('shop:onExtendProductReviewForm', $this, 'extend_product_review_model');
}

public function extend_product_review_model($product_review)
{
	$product_review->define_column('x_would_recommend', 'Would recommend this product to a friend');
}
		 
public function extend_product_review_model($product_review, $context)
{
	$product_review->add_form_field('x_would_recommend')->tab('Review');
}

Next: shop:onExtendProductReviewForm event
Previous: shop:onOrderRestored event
Return to Handling LemonStand events