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