shop:onExtendProductsToolbar event
The shop:onExtendProductsToolbar event allows to add new button to the toolbar above the product list 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 "Subscription plans" button to the products toolbar. Similar code used in the Subscriptions module.
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendProductsToolbar', $this, 'extend_products_toolbar');
}
public function extend_products_toolbar($controller)
{
$controller->renderPartial(PATH_APP.'/modules/mymodule/partials/_products_toolbar.htm');
}
// Example of the _products_toolbar.htm partial
<div class="separator"> </div>
<?= backend_ctr_button('Subscription plans', 'subscription_plans', url('subscriptions/plans')) ?>
Next: shop:onBeforeProductFileAdded event
Previous: shop:onBeforeSetCartQuantity event
Return to Handling LemonStand events

