shop:onExtendProductForm event
This event allows to add new fields to the Create/Edit Product form in the Administration Area. Usually this event is used together with the shop:onExtendProductModel event. You can download a module template extending the product model in Module Templates documentation section. The event handler should accept two parameters - the product object (Shop_Product) and the form execution context string. To add new fields to the form, please call the add_form_field() method of the product object. Please read the Extending existing models article to learn more about extending the product model.
Example of the event handler:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendProductModel', $this, 'extend_product_model');
Backend::$events->addEvent('shop:onExtendProductForm', $this, 'extend_product_form');
}
public function extend_product_model($product)
{
$product->define_column('x_extra_description', 'Extra description');
}
public function extend_product_form($product, $context)
{
$product->add_form_field('x_extra_description')->tab('Product');
}
Next: shop:onGetOrderFieldOptions event
Previous: shop:onExtendProductModel event
Return to Handling LemonStand events

