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

Triggered by Shop_OrderItem
Author LemonStand eCommerce Inc.

Event handler signature

public void event_onExtendOrderItemModel(Shop_OrderItem $item, string $context)
$item Shop_OrderItem specifies the order item object.
$context string specifies the execution context.
Allows to define new columns in the order item model. The event handler should accept two parameters - the order item object and the form execution context string. To add new columns to the order item model, call the define_column() method of the item object. Before you add new columns to the model, you should add them to the database (the shop_order_items table).
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onExtendOrderItemModel', $this, 'extend_order_item_model');
  Backend::$events->addEvent('shop:onExtendOrderItemForm', $this, 'extend_order_item_form');
}

public function extend_order_item_model($order_item)
{
  $order_item->define_column('x_subscription_start_date', 'Start date')->invisible();
  $order_item->define_column('x_subscription_end_date', 'End date')->invisible();
}

public function extend_order_item_form($order_item)
{
  $order_item->add_form_field('x_subscription_start_date', 'left')->tab('Subscription');
  $order_item->add_form_field('x_subscription_end_date', 'right')->tab('Subscription');
}