Allows to define new columns in the product type model.
The event handler should accept a single parameter - the product type object. To add new columns to the product type model,
call the
define_column() method of the product type object. Before you add new columns to the model,
you should add them to the database (the
shop_product_types table).
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendProductTypeModel', $this, 'extend_product_type_model');
Backend::$events->addEvent('shop:onExtendProductTypeForm', $this, 'extend_product_type_model');
}
public function extend_product_type_model($product_type)
{
$product_type->define_column('x_custom_column', 'A custom column');
}
public function extend_product_type_form($product_type, $context)
{
$product_type->add_form_field('x_custom_column')->tab('Product Type');
}