shop:onExtendCustomerPreviewToolbar event
The shop:onExtendCustomerPreviewToolbar event allows to add new buttons to the toolbar on the Customer Preview page in the Administration Area. The event handler should accept 2 parameters - the controller object, which you can use for rendering a partial, containing new buttons, and a customer object (Shop_Customer). The following example adds the "Subscription plans" button to the customer toolbar. Similar code used in the Subscriptions module.
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendCustomerPreviewToolbar', $this, 'extend_customer_toolbar');
}
public function extend_customer_toolbar($controller, $customer)
{
$controller->renderPartial(PATH_APP.'/modules/subscriptions/partials/_customer_toolbar.htm',
array(
'customer'=>$customer
));
}
// Example of the _customer_toolbar.htm partial
<? if (Subscriptions_Engine::get()->customer_has_subscriptions($customer->id)): ?>
<div class="separator"> </div>
<?= backend_ctr_button('Subscription chart', 'subscription_chart',
url('subscriptions/chart/customer/'.$customer->id)) ?>
<? endif ?>
Next: shop:onExtendOrderInvoicesToolbar event
Previous: shop:onGetCustomerFieldOptions event
Return to Handling LemonStand events

