This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

shop:onExtendOptionModel event

Triggered by Shop_CustomAttribute
Author LemonStand eCommerce Inc.

Event handler signature

public void event_onExtendOptionModel(Shop_CustomAttribute $option)
$option Shop_CustomAttribute specifies the product option object.
Allows to define new columns in the product option model. The event handler should accept a single parameter - the product option object. To add new columns to the product option model, call the define_column() method of the product option object. Before you add new columns to the model, you should add them to the database (the shop_custom_attributes table).
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');
}