LemonStand Documentation

shop:onExtendCustomerForm event

This event allows to add new fields to the Create/Edit Customer form in the Administration Area. Usually this event is used together with the shop:onExtendCustomerModel event. You can download a module template extending the customer model in Module Templates documentation section. The event handler should accept two parameters - the customer object (Shop_Customer) and the form execution context string. To add new fields to the customer form, please call the add_form_field() method of the customer object. Please read the Extending existing models article to learn more about extending the customer model.

Example of the event handler:

public function subscribeEvents()
{
    Backend::$events->addEvent('shop:onExtendCustomerModel', $this, 'extend_customer_model');
    Backend::$events->addEvent('shop:onExtendCustomerForm', $this, 'extend_customer_form');
}
 
public function extend_customer_model($customer, $context)
{
    $customer->define_column('x_extra_description', 'Extra description');
}
 
public function extend_customer_form($customer, $context)
{
    $customer->add_form_field('x_extra_description')->tab('Customer');
}

Next: shop:onExtendManufacturerModel event
Previous: shop:onExtendCustomerModel event
Return to Handling LemonStand events