Allows to define new columns in the product review model.
The event handler should accept two parameters - the review object and the form
execution context string. To add new columns to the review model, call the
define_column()
method of the review object. Before you add new columns to the model, you should add them to the
database (the
shop_product_reviews table).
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');
}