Allows to define new columns in the product category model.
The event handler should accept two parameters - the category object and the form
execution context string. To add new columns to the category model, call the
define_column()
method of the category object. Before you add new columns to the model, you should add them to the
database (the
shop_categories table).
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendCategoryModel', $this, 'extend_category_model');
Backend::$events->addEvent('shop:onExtendCategoryForm', $this, 'extend_category_form');
}
public function extend_category_model($category, $context)
{
$category->define_column('x_extra_description', 'Extra description');
}
public function extend_category_form($category, $context)
{
$category->add_form_field('x_extra_description')->tab('Category');
}