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

Triggered by Shop_Order
Author LemonStand eCommerce Inc.

Event handler signature

public void event_onBeforeOrderRecordCreate(Shop_Order $order, string $session_key)
$order Shop_Order specifies the order object.
$session_key string specifies the form session key.
Triggered before a new order record is saved to the database. Unlike the shop:onOrderBeforeCreate event, this event is triggered even if the order is created from the Administration Area. In case if the order is created from the front-end website, this event triggers after the shop:onOrderBeforeCreate.
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onBeforeOrderRecordCreate', $this, 'process_new_order_record');
}

public function process_new_order_record($order, $session_key)
{
  // Load the item list
  $items = $order->list_related_records_deferred('items', $deferred_session_key);

  // Perform some check
  foreach ($items as $item)
  {
    if ($item->quantity > 10)
      throw new Phpr_ApplicationException('Error!');
  }
}