Allows to define new columns in the product option model.
The event handler should accept a single parameter - the product option object. To add new columns to the product option model,
call the
define_column() method of the product option object. Before you add new columns to the model,
you should add them to the database (the
shop_custom_attributes table).
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendOptionModel', $this, 'extend_option_model');
Backend::$events->addEvent('shop:onExtendOptionForm', $this, 'extend_option_form');
}
public function extend_option_model($option)
{
$option->define_column('x_color', 'Color');
}
public function extend_option_form($option, $context)
{
$option->add_form_field('x_color');
}