LemonStand Documentation

shop:onExtendOrderPreviewToolbar event

The shop:onExtendOrderPreviewToolbar event allows to add new buttons to the toolbar above the Order Preview form. The event handler should accept 2 parameters - the controller object, which you can use for rendering a partial, containing new buttons, and the order object (Shop_Order). The following example adds the "Subscription chart" button to the order preview toolbar. Similar code used in the Subscriptions module.

public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onExtendOrderPreviewToolbar', $this, 'extend_order_toolbar');
}
 
public function extend_order_toolbar($controller, $order)
{
  $controller->renderPartial(PATH_APP.'/modules/subscriptions/partials/_order_toolbar.htm',
    array('order'=>$order));
}

// Example of the _order_toolbar.htm partial

<? if (Subscriptions_Engine::get()->order_has_subscriptions($order->id)): ?>
  <div class="separator">&nbsp;</div>
  <?= backend_ctr_button('Subscription chart', 'subscription_chart', url('subscriptions/chart/order/'.$order->id)) ?>
<? endif ?>

Next: shop:onOrderItemAdded event
Previous: shop:onBeforeOrderInternalStatusMessageSent
Return to Handling LemonStand events