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:onGetOrderStatusFieldOptions event

Triggered by Shop_OrderStatus
Author LemonStand eCommerce Inc.

Event handler signature

public mixed event_onGetOrderStatusFieldOptions(string $db_name, string $field_value)
$db_name string specifies the field name.
$field_value string specifies the field value.
{return} mixed returns a list of options or a specific option label.
Allows to populate drop-down, radio- or checkbox list fields, which have been added with shop:onExtendOrderStatusForm event. Usually you do not need to use this event for fields which represent data relations. But if you want a standard field (corresponding an integer-typed database column, for example), to be rendered as a drop-down list, you should handle this event.
The event handler should accept 2 parameters - the field name and a current field value. If the current field value is -1, the handler should return an array containing a list of options. If the current field value is not -1, the handler should return a string (label), corresponding the value.
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onExtendOrderStatusModel', $this, 'extend_order_status_model');
  Backend::$events->addEvent('shop:onExtendOrderStatusForm', $this, 'extend_order_status_form');
  Backend::$events->addEvent('shop:onGetOrderStatusFieldOptions', $this, 'get_order_status_field_options');
}

public function extend_order_status_model($status, $context)
{
  $status->define_column('x_custom_column', 'Custom column')->invisible();
}

public function extend_order_status_form($status, $context)
{
  $status->add_form_field('x_custom_column')->tab('Order Status')->renderAs(frm_dropdown);
}

public function get_order_status_field_options($field_name, $current_key_value)
{
  if ($field_name == 'x_custom_column')
  {
    $options = array(
      0 => 'Option 1',
      1 => 'Option 2'
    );

    if ($current_key_value == -1)
      return $options;

    if (array_key_exists($current_key_value, $options))
      return $options[$current_key_value];
  }
}