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

Triggered by Shop_OrderStatusLog
Author LemonStand eCommerce Inc.

Event handler signature

public boolean event_onOrderBeforeStatusChanged(Shop_Order $order, integer $status_id, integer $prev_status_id, string $comment, boolean $send_notifications)
$order Shop_Order specifies the order object.
$status_id integer specifies a new order status identifier.
$prev_status_id integer specifies a previous order status identifier.
$comment string specifies an optional status transition comment.
$send_notifications boolean determines whether notifications should be sent to the customer and LemonStand users.
{return} boolean returns FALSE if the status transition should be cancelled.
Triggered before an order changes its status. The event allows to cancel the status update. To cancel the update the handler should return FALSE. Event handler example:
public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onOrderBeforeStatusChanged', $this, 'before_status_changed');
}

public function before_status_changed($order, $new_status_id, $prev_status_id, $comments, $send_notifications)
{
  $status = Shop_OrderStatus::create()->find($new_status_id);

  //for orders over $250, set the status to "New big order" instead of "New"
  if($status && $status->code == 'new' && $order->subtotal >= 250)
  {
    $new_status = Shop_OrderStatus::create()->find_by_code('new_big');
    if($new_status)
    {
      Shop_OrderStatusLog::create_record($new_status->id, $order, $comments, $send_notifications);
      return false;
    }
  }
}