Allows to define new columns in the payment method model.
The event handler should accept a single parameter - the payment method object. To add new columns to the payment method model,
call the
define_column() method of the payment method object. Before you add new columns to the model,
you should add them to the database (the
shop_payment_methods table).
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendPaymentMethodModel', $this, 'extend_payment_method_model');
Backend::$events->addEvent('shop:onExtendPaymentMethodForm', $this, 'extend_payment_method_form');
}
public function extend_payment_method_model($payment_method)
{
$payment_method->define_column('x_extra_description', 'Extra description');
}
public function extend_payment_method_form($payment_method, $context)
{
$payment_method->add_form_field('x_extra_description')->tab('Custom');
}