LemonStand Documentation

shop:onExtendOrderInvoicesToolbar event

The shop:onExtendOrderInvoicesToolbar event allows to add new button to the toolbar above the invoice list on the Order Preview page in the Administration Area. The event handler should accept a single parameter - the controller object, which you can use for rendering a partial, containing new buttons. The following example adds the "Generate subscription invoice" button to the toolbar. Similar code used in the Subscriptions module.

public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onExtendOrderInvoicesToolbar', $this, 'extend_invoices_toolbar');
}
 
public function extend_invoices_toolbar($controller)
{
  $controller->renderPartial(PATH_APP.'/modules/subscriptions/partials/_invoices_toolbar.htm');
}

// Example of the _invoices_toolbar.htm partial

<div class="separator">&nbsp;</div>
<?= backend_ctr_button(
  'Generate subscription invoice', 
  'generate_subscription_invoice', 
  array('href'=>'#', 'onclick'=>"
    new PopupForm('onCustomEvent', {
      closeByEsc: false, 
      ajaxFields: {custom_event_handler: 'subscriptions:onGenerateInvoice'}
  }); return false;
")) ?>

Next: shop:onOrderBeforeStatusChanged event
Previous: shop:onExtendCustomerPreviewToolbar event
Return to Handling LemonStand events