LemonStand Documentation

shop:onExtendCustomGroupModel event

The shop:onExtendCustomGroupModel event allows to add new columns to the product group model. Before you add columns to the model, your module should add corresponding columns to the database (the shop_custom_group table). You can learn about updating the database structure from the Creating and updating database tables article.

The event handler should accept a single parameter - the product group object (Shop_CustomGroup class). Example:

public function subscribeEvents()
{
	Backend::$events->addEvent('shop:onExtendCustomGroupModel', $this, 'extend_custom_group_model');
	Backend::$events->addEvent('shop:onExtendCustomGroupForm', $this, 'extend_custom_group_form');
}
		
public function extend_custom_group_model($custom_group, $context)
{
	$custom_group->define_column('x_gender', 'Gender');
}
		
public function extend_custom_group_form($custom_group, $context)
{
	$custom_group->add_form_field('x_gender')->tab('Group');
}

Next: shop:onExtendCustomGroupForm event
Previous: shop:onGetOptionFieldOptions event
Return to Handling LemonStand events