shop:onExtendProductModel event
This event allows you to define new fields in the product model. You can download a module template extending the product model in Module Templates documentation section. The event handler should accept a single parameter - the product object (Shop_Product). To add new columns to the product model, please call the define_column() method of the product object. Before you add new columns to the product model, you should add them to the database (the shop_products table). 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:onExtendProductForm event
Previous: shop:onExtendOrderForm event
Return to Handling LemonStand events

