LemonStand Documentation

shop:onExtendOptionForm event

The shop:onExtendOptionForm event allows to add new fields to the Create/Edit Option form in the Administration Area. This event is usually used with the shop:onExtendOptionModel event. The event handler should accept a single parameter - the option object (Shop_CustomAttribute class). Example:

public function subscribeEvents()
{
	Backend::$events->addEvent('shop:onExtendOptionModel', $this, 'extend_option_model');
	Backend::$events->addEvent('shop:onExtendOptionForm', $this, 'extend_option_form');
}

public function extend_option_model($option)
{
	$option->define_column('x_color', 'Color');
}
		 
public function extend_option_form($option, $context)
{
	$option->add_form_field('x_color')->renderAs(frm_dropdown);
}

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