Edit in GitHubLog an issue
Thanks to Goivvy LLC for contributing this topic!

List of events

This is the list of event names ordered alphabetically. Each event contains a short description and a list of supported arguments.

abstract_search_result_load_after#

Use cases#

To modify product stock items and stock statuses.

Origins#

\Magento\Framework\Data\AbstractSearchResult:

Copied to your clipboard
1protected function afterLoad()
2{
3 $this->eventManager->dispatch('abstract_search_result_load_after', ['collection' => $this]);
  • collection is an object of \Magento\Framework\Data\AbstractSearchResult

Examples of classes that raise the event#

  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Collection
  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Collection
  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Status\Collection

abstract_search_result_load_before#

Use cases#

To modify product stock items and stock statuses.

Origins#

\Magento\Framework\Data\AbstractSearchResult:

Copied to your clipboard
1protected function beforeLoad()
2{
3$this->eventManager->dispatch('abstract_search_result_load_before', ['collection' => $this]);
  • collection is an object of \Magento\Framework\Data\AbstractSearchResult

Classes raising the event#

  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Collection
  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Item\Collection
  • \Magento\CatalogInventory\Model\ResourceModel\Stock\Status\Collection

adminhtml_block_eav_attribute_edit_form_init#

Use cases#

To modify backend attribute edit page form.

Origins#

\Magento\Eav\Block\Adminhtml\Attribute\Edit\Main\AbstractMain:

Copied to your clipboard
1protected function _initFormValue()
2{
3$this->eventManager->dispatch('adminhtml_block_eav_attribute_edit_form_init', ['form' => $this->getForm()]);
  • form is an object of \Magento\Framework\Data\Form

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main

adminhtml_block_html_before#

Origins#

  • \Magento\Backend\Block\Template::_toHtml():

    Copied to your clipboard
    1protected function _toHtml()
    2{
    3$this->_eventManager->dispatch('adminhtml_block_html_before', ['block' => $this]);
  • \Magento\Customer\\Block\Adminhtml\Edit\Tab\Carts::_toHtml():

    Copied to your clipboard
    1protected function _toHtml()
    2{
    3$this->_eventManager->dispatch('adminhtml_block_html_before', ['block' => $this]);
  • block is an object of \Magento\Framework\View\Element\Template

Classes raising the event#

  • \Magento\AdminNotification\Block\System\Messages
  • \Magento\AdobeIms\Block\Adminhtml\SignIn

Use cases#

To modify backend block contents.

adminhtml_block_promo_widget_chooser_prepare_collection#

Use cases#

To modify collection of shopping cart rules used in a chooser widget.

Origins#

\Magento\SalesRule\Block\Adminhtml\Promo\Widget\Chooser::_prepareCollection():

Copied to your clipboard
1protected function _prepareCollection()
2{
3...
4$this->_eventManager->dispatch(
5 'adminhtml_block_promo_widget_chooser_prepare_collection',
6 ['collection' => $collection]
7);
  • collection is an object of \Magento\SalesRule\Model\ResourceModel\Rule\Collection

Classes raising the event#

  • \Magento\SalesRule\Block\Adminhtml\Promo\Widget\Chooser

adminhtml_block_salesrule_actions_prepareform#

Use cases#

To modify sales rule actions form.

Origins#

\Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Actions::addTabToForm():

Copied to your clipboard
1protected function addTabToForm($model
2 , $fieldsetId = 'actions_fieldset'
3 , $formName = 'sales_rule_form')
4{
5...
6$this->_eventManager->dispatch('adminhtml_block_salesrule_actions_prepareform'
7 , ['form' => $form]);
8);
  • form is an object of \Magento\Framework\Data\Form

Classes raising the event#

  • \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Actions

adminhtml_cache_flush_all#

Use cases#

To perform actions before all cache is flushed.

Origins#

  • \Magento\Backend\Controller\Adminhtml\Cache\FlushAll::execute():

    Copied to your clipboard
    1public function execute()
    2{
    3$this->_eventManager->dispatch('adminhtml_cache_flush_all');
  • \Magento\Backend\Console\Command\CacheFlushCommand::performAction():

    Copied to your clipboard
    1protected function performAction(array $cacheTypes)
    2{
    3$this->eventManager->dispatch('adminhtml_cache_flush_all');

Classes raising the event#

  • \Magento\Backend\Controller\Adminhtml\Cache\FlushAll
  • \Magento\Backend\Console\Command\CacheFlushCommand

adminhtml_cache_flush_system#

Use cases#

To perform actions when system cache is cleaned.

Origins#

  • \Magento\Translation\Model\Inline\CacheManager::updateAndGetTranslations():

    Copied to your clipboard
    1public function updateAndGetTranslations()
    2{
    3$this->eventManager->dispatch('adminhtml_cache_flush_system');
  • \Magento\Backend\Controller\Adminhtml\Cache\FlushSystem::execute():

    Copied to your clipboard
    1public function execute()
    2{
    3...
    4$this->_eventManager->dispatch('adminhtml_cache_flush_system');
  • \Magento\Backend\Console\Command\CacheCleanCommand::performAction()

    Copied to your clipboard
    1protected function performAction(array $cacheTypes)
    2{
    3$this->eventManager->dispatch('adminhtml_cache_flush_system');

Classes raising the the event#

  • \Magento\Translation\Model\Inline\CacheManager
  • \Magento\Backend\Controller\Adminhtml\Cache\FlushSystem
  • \Magento\Backend\Console\Command\CacheCleanCommand

adminhtml_cache_refresh_type#

Use cases#

  • To perform actions before Full Page Cache is cleared.
  • To perform actions after Configuration Cache is cleared.

Origins#

  • \Magento\Tax\Controller\Adminhtml\Tax\IgnoreTaxNotification::execute():

    Copied to your clipboard
    1public function execute()
    2{
    3$this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'config']);
    • type for cache type cleared
  • \Magento\PageCache\Model\Cache\Type::clean():

    Copied to your clipboard
    1public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = [])
    2{
    3$this->eventManager->dispatch('adminhtml_cache_refresh_type');

Classes raising the the event#

  • \Magento\Tax\Controller\Adminhtml\Tax\IgnoreTaxNotification
  • \Magento\PageCache\Model\Cache\Type

adminhtml_catalog_category_tree_can_add_root_category#

Use cases#

To change availability of adding root category.

Origins#

\Magento\Catalog\Block\Adminhtml\Category\Tree::canAddRootCategory():

Copied to your clipboard
1public function canAddRootCategory()
2{
3 $options = new \Magento\Framework\DataObject(['is_allow' => true]);
4 $this->_eventManager->dispatch(
5 'adminhtml_catalog_category_tree_can_add_root_category',
6 ['category' => $this->getCategory(), 'options' => $options, 'store' => $this->getStore()->getId()]
7 );
  • category - product category
  • options - \Magento\Framework\DataObject(['is_allow' => true])
  • store - current store ID

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Category\Checkboxes\Tree
  • \Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser

adminhtml_catalog_category_tree_can_add_sub_category#

Use cases#

To change availability of adding a subcategory.

Origins#

\Magento\Catalog\Block\Adminhtml\Category\Tree::canAddSubCategory():

Copied to your clipboard
1public function canAddSubCategory()
2{
3 $options = new \Magento\Framework\DataObject(['is_allow' => true]);
4 $this->_eventManager->dispatch(
5 'adminhtml_catalog_category_tree_can_add_sub_category',
6 ['category' => $this->getCategory(), 'options' => $options, 'store' => $this->getStore()->getId()]
7 );
  • category - product category
  • options - \Magento\Framework\DataObject(['is_allow' => true])
  • store - current store ID

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Category\Checkboxes\Tree
  • \Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser

adminhtml_catalog_category_tree_is_moveable#

Use cases#

To change moveability of a category.

Origins#

\Magento\Catalog\Block\Adminhtml\Category\Tree::_isCategoryMoveable():

Copied to your clipboard
1protected function _isCategoryMoveable($node)
2{
3 $options = new \Magento\Framework\DataObject(['is_moveable' => true, 'category' => $node]);
4
5 $this->_eventManager->dispatch('adminhtml_catalog_category_tree_is_moveable', ['options' => $options]);
  • options - \Magento\Framework\DataObject(['is_moveable' => true, 'category' => $node])

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Category\Checkboxes\Tree
  • \Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser

adminhtml_catalog_product_attribute_edit_frontend_prepare_form#

Use cases#

To customize a product attribute edit form.

Origins#

\Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front::_prepareForm():

Copied to your clipboard
1protected function _prepareForm()
2{
3...
4$this->_eventManager->dispatch(
5 'adminhtml_catalog_product_attribute_edit_frontend_prepare_form',
6 ['form' => $form, 'attribute' => $attributeObject]
7);
  • form is an object of \Magento\Framework\Data\Form
  • attribute is an object of \Magento\Catalog\Model\Entity\Attribute

Classes raising the event#

\Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front

adminhtml_catalog_product_attribute_set_main_html_before#

Use cases#

To customize the adminhtml catalog attribute set main block.

Origins#

\Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main::_toHtml():

Copied to your clipboard
1 protected function _toHtml()
2 {
3 $this->_eventManager->dispatch(
4 'adminhtml_catalog_product_attribute_set_main_html_before',
5 ['block' => $this]
6 );
  • block is an object of \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main

adminhtml_catalog_product_attribute_set_toolbar_main_html_before#

Use cases#

To customize the adminhtml catalog attribute set toolbar main block.

Origins#

\Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Main::_toHtml():

Copied to your clipboard
1 protected function _toHtml()
2 {
3 $this->_eventManager->dispatch(
4 'adminhtml_catalog_product_attribute_set_toolbar_main_html_before',
5 ['block' => $this]
6 );
  • block is an object of \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Main

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Main

adminhtml_catalog_product_edit_element_types#

Use cases#

To add or customize additional element types for catalog product edit attributes tab.

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes::_getAdditionalElementTypes():

    Copied to your clipboard
    1 protected function _getAdditionalElementTypes()
    2 {
    3 ...
    4 $this->_eventManager->dispatch('adminhtml_catalog_product_edit_element_types',
    5 ['response' => $response]);
  • response is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes
  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes

adminhtml_catalog_product_edit_prepare_form#

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes::_prepareForm():

    Copied to your clipboard
    1 protected function _prepareForm()
    2 {
    3 ...
    4 $this->_eventManager->dispatch(
    5 'adminhtml_catalog_product_edit_prepare_form',
    6 ['form' => $form, 'layout' => $this->getLayout()]
    7 );
  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\NewAttribute\Product\Attributes::_prepareForm():

    Copied to your clipboard
    1 protected function _prepareForm()
    2 {
    3 ...
    4 $this->_eventManager->dispatch('adminhtml_catalog_product_edit_prepare_form',
    5 ['form' => $form]
    6 );
  • form is an object of \Magento\Framework\Data\Form

  • layout is an object of \Magento\Framework\View\LayoutInterface

There are only three classes that raise this event:

  • \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes
  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes
  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\NewAttribute\Product\Attributes

Use cases#

To customize catalog product edit attribute tab form

adminhtml_catalog_product_edit_tab_attributes_create_html_before#

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Create::_toHtml():

    Copied to your clipboard
    1 protected function _toHtml()
    2 {
    3 $this->setCanShow(true);
    4 $this->_eventManager->dispatch(
    5 'adminhtml_catalog_product_edit_tab_attributes_create_html_before',
    6 ['block' => $this]
    7 );
  • block is an object of \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Create

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Create

Use cases#

To customize catalog product edit create attribute block

adminhtml_catalog_product_form_prepare_excluded_field_list#

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Attributes::_prepareForm():

    Copied to your clipboard
    1 protected function _prepareForm(): void
    2 {
    3 $this->setFormExcludedFieldList($this->excludeFields);
    4 $this->_eventManager->dispatch(
    5 'adminhtml_catalog_product_form_prepare_excluded_field_list',
    6 ['object' => $this]
    7 );
  • object is an object of \Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Attributes

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Attributes

Use cases#

To customize catalog product edit attribute tab block

adminhtml_catalog_product_grid_prepare_massaction#

Use cases#

To customize Mass Actions of a catalog product grid backend block.

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Grid::_prepareMassaction():

    Copied to your clipboard
    1 protected function _prepareMassaction()
    2 {
    3 ...
    4
    5 $this->_eventManager->dispatch('adminhtml_catalog_product_grid_prepare_massaction',
    6 ['block' => $this]);
    7 return $this;
    8 }
  • block is an object of \Magento\Catalog\Block\Adminhtml\Product\Grid

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Grid
  • \Magento\UrlRewrite\Block\Catalog\Product\Grid

adminhtml_cmspage_on_delete#

Origins#

  • \Magento\Cms\Controller\Adminhtml\Page\Delete::execute():

    Copied to your clipboard
    1 protected function execute()
    2 {
    3 ...
    4 $this->_eventManager->dispatch('adminhtml_cmspage_on_delete', [
    5 'title' => $title,
    6 'status' => 'success'
    7 ]);
    8
    9 return $resultRedirect->setPath('*/*/');
    10 } catch (\Exception $e) {
    11 $this->_eventManager->dispatch(
    12 'adminhtml_cmspage_on_delete',
    13 ['title' => $title, 'status' => 'fail']
    14 );
    15 ...
    16 }
  • title is a string, title of a cms page

  • status is a string, 'success' or 'fail'

Classes raising the event#

  • \Magento\Cms\Controller\Adminhtml\Page\Delete

Use cases#

To perform actions on either successful or unsuccessful cms page removal

adminhtml_controller_catalogrule_prepare_save#

Origins#

  • \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog\Save::execute():

    Copied to your clipboard
    1 protected function execute()
    2 {
    3 ...
    4 try {
    5 $this->_eventManager->dispatch(
    6 'adminhtml_controller_catalogrule_prepare_save',
    7 ['request' => $this->getRequest()]
    8 );
    9 ...
    10 }
  • request is a page request object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog\Save

Use cases#

To alter how a catalog price rule is being saved

adminhtml_controller_salesrule_prepare_save#

Origins#

  • \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save::execute():

    Copied to your clipboard
    1 protected function execute()
    2 {
    3 ...
    4 try {
    5 ...
    6 $this->_eventManager->dispatch(
    7 'adminhtml_controller_salesrule_prepare_save',
    8 ['request' => $this->getRequest()]
    9 );
    10 ...
    11 }
  • request is a page request object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save

Use cases#

To alter how a cart price rule is being saved

adminhtml_customer_orders_add_action_renderer#

Origins#

  • \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action::render():

    Copied to your clipboard
    1 public function render(\Magento\Framework\DataObject $row)
    2 {
    3 ...
    4 $this->_eventManager->dispatch(
    5 'adminhtml_customer_orders_add_action_renderer',
    6 ['renderer' => $this, 'row' => $row]
    7 );
  • renderer is an object of \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action

  • row is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action

Use cases#

To modify the way action sales admin reorder block is rendered

adminhtml_customer_prepare_save#

Use cases#

To modify a customer object before it is saved in admin panel.

Origins#

\Magento\Customer\Controller\Adminhtml\Index\Save::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'adminhtml_customer_prepare_save',
6 ['customer' => $customer, 'request' => $this->getRequest()]
7 );
  • customer is an object of \Magento\Customer\Api\Data\CustomerInterface
  • request is an object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\Customer\Controller\Adminhtml\Index\Save

adminhtml_customer_save_after#

Use cases#

To modify a customer object after it is saved in admin panel.

Origins#

\Magento\Customer\Controller\Adminhtml\Index\Save::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'adminhtml_customer_save_after',
6 ['customer' => $customer, 'request' => $this->getRequest()]
7 );
  • customer is an object of \Magento\Customer\Api\Data\CustomerInterface
  • request is an object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\Customer\Controller\Adminhtml\Index\Save

adminhtml_product_attribute_types#

Use cases#

To modify the way product attributes are processed.

Origins#

  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main::execute():

    Copied to your clipboard
    1 private function processFrontendInputTypes(): void
    2 {
    3 ...
    4 $this->_eventManager->dispatch('adminhtml_product_attribute_types', ['response' => $response]);
  • \Magento\Catalog\Model\Product\Attribute\Source\Inputtype::toOptionArray():

    Copied to your clipboard
    1public function toOptionArray()
    2{
    3...
    4$this->_eventManager->dispatch('adminhtml_product_attribute_types', ['response' => $response]);

response is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main
  • \Magento\Catalog\Model\Product\Attribute\Source\Inputtype

adminhtml_promo_quote_edit_tab_coupons_form_prepare_form#

Use cases#

To modify the admin coupon code form is generated.

Origins#

\Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form::_prepareForm():

Copied to your clipboard
1 protected function _prepareForm()
2 {
3 $this->_eventManager->dispatch(
4 'adminhtml_promo_quote_edit_tab_coupons_form_prepare_form',
5 ['form' => $form]
6 );
  • form is an object of \Magento\Framework\Data\Form

Classes raising the event#

  • \Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form

adminhtml_sales_order_create_process_data#

Use cases#

To modify an order after it gets processed.

Origins#

\Magento\Sales\Controller\Adminhtml\Order\Create::_processActionData():

Copied to your clipboard
1 protected function _processActionData()
2 {
3 ...
4 $eventData = [
5 'order_create_model' => $this->_getOrderCreateModel(),
6 'request' => $this->getRequest()->getPostValue(),
7 ];
8
9 $this->_eventManager->dispatch('adminhtml_sales_order_create_process_data', $eventData);
  • order_create_model is an object of \Magento\Sales\Model\AdminOrder\Create
  • request is an array of POST values

Classes raising the event#

  • \Magento\Sales\Controller\Adminhtml\Order\Create\Cancel
  • \Magento\Sales\Controller\Adminhtml\Order\Create\ProcessData

adminhtml_sales_order_create_process_data_before#

Use cases#

To modify an order before it gets processed.

Origins#

\Magento\Sales\Controller\Adminhtml\Order\Create::_processActionData():

Copied to your clipboard
1 protected function _processActionData()
2 {
3 $eventData = [
4 'order_create_model' => $this->_getOrderCreateModel(),
5 'request_model' => $this->getRequest(),
6 'session' => $this->_getSession(),
7 ];
8
9 $this->_eventManager->dispatch('adminhtml_sales_order_create_process_data_before', $eventData);
  • order_create_model is an object of \Magento\Sales\Model\AdminOrder\Create
  • request_model is an object of \Magento\Framework\App\RequestInterface
  • session is an object of \Magento\Backend\Model\Session\Quote

Classes raising the event#

  • \Magento\Sales\Controller\Adminhtml\Order\Create\Cancel
  • \Magento\Sales\Controller\Adminhtml\Order\Create\ProcessData

adminhtml_sales_order_create_process_item_after#

Use cases#

To modify an order item after it gets processed.

Origins#

\Magento\Sales\Controller\Adminhtml\Order\Create::_processActionData():

Copied to your clipboard
1 protected function _processActionData()
2 {
3 $eventData = [
4 'order_create_model' => $this->_getOrderCreateModel(),
5 'request_model' => $this->getRequest(),
6 'session' => $this->_getSession(),
7 ];
8 ...
9 $this->_eventManager->dispatch('adminhtml_sales_order_create_process_item_after', $eventData);
  • order_create_model is an object of \Magento\Sales\Model\AdminOrder\Create
  • request_model is an object of \Magento\Framework\App\RequestInterface
  • session is an object of \Magento\Backend\Model\Session\Quote

Classes raising the event#

  • \Magento\Sales\Controller\Adminhtml\Order\Create\Cancel
  • \Magento\Sales\Controller\Adminhtml\Order\Create\ProcessData

adminhtml_sales_order_create_process_item_before#

Use cases#

To modify an order item before it gets processed.

Origins#

\Magento\Sales\Controller\Adminhtml\Order\Create::_processActionData():

Copied to your clipboard
1 protected function _processActionData()
2 {
3 $eventData = [
4 'order_create_model' => $this->_getOrderCreateModel(),
5 'request_model' => $this->getRequest(),
6 'session' => $this->_getSession(),
7 ];
8 ...
9 $this->_eventManager->dispatch('adminhtml_sales_order_create_process_item_before', $eventData);
  • order_create_model is an object of \Magento\Sales\Model\AdminOrder\Create
  • request_model is an object of \Magento\Framework\App\RequestInterface
  • session is an object of \Magento\Backend\Model\Session\Quote

Classes raising the event#

  • \Magento\Sales\Controller\Adminhtml\Order\Create\Cancel
  • \Magento\Sales\Controller\Adminhtml\Order\Create\ProcessData

adminhtml_sales_order_creditmemo_register_before#

Use cases#

To modify a credit memo before it gets saved in the registry.

Origins#

  • \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader::load():

    Copied to your clipboard
    1 public function load()
    2 {
    3 ...
    4 $this->eventManager->dispatch(
    5 'adminhtml_sales_order_creditmemo_register_before',
    6 ['creditmemo' => $creditmemo, 'input' => $this->getCreditmemo()]
    7 );
  • creditmemo is an object of \Magento\Sales\Model\Order\Creditmemo

  • input is a data array

Classes raising the event#

  • \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader

adminhtml_store_edit_form_prepare_form#

Use cases#

To a store edit form before it gets rendered.

Origins#

\Magento\Backend\Block\System\Store\Edit\AbstractForm::_prepareForm():

Copied to your clipboard
1 protected function _prepareForm()
2 {
3 ...
4 $this->_eventManager->dispatch('adminhtml_store_edit_form_prepare_form', ['block' => $this]);
  • block is an object of \Magento\Backend\Block\System\Store\Edit\AbstractForm

Classes raising the event#

  • \Magento\Backend\Block\System\Store\Edit\Form\Website
  • \Magento\Backend\Block\System\Store\Edit\Form\Group
  • \Magento\Backend\Block\System\Store\Edit\Form\Store

adminhtml_system_config_advanced_disableoutput_render_before#

Use cases#

To alter modules list before they get displayed.

Origins#

\Magento\Config\Block\System\Config\Form\Fieldset\Modules\DisableOutput::render():

Copied to your clipboard
1 protected function render()
2 {
3 ...
4 $dispatchResult = new \Magento\Framework\DataObject($modules);
5 $this->_eventManager->dispatch(
6 'adminhtml_system_config_advanced_disableoutput_render_before',
7 ['modules' => $dispatchResult]
8 );
  • modules is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Config\Block\System\Config\Form\Fieldset\Modules\DisableOutput

adminhtml_widget_grid_filter_collection#

Use cases#

To alter report collection or filter values.

Origins#

\Magento\Reports\Block\Adminhtml\Grid::_prepareCollection():

Copied to your clipboard
1 protected function _prepareCollection()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'adminhtml_widget_grid_filter_collection',
6 ['collection' => $this->getCollection(), 'filter_values' => $this->_filterValues]
7 );
  • collection is an object of \Magento\Reports\Model\ResourceModel\Report\Collection
  • filter_values is a value array

Classes raising the event#

  • \Magento\Reports\Block\Adminhtml\Grid

admin_permissions_role_prepare_save#

Use cases#

To alter the role object before it is saved.

Origins#

\Magento\User\Controller\Adminhtml\User\Role\SaveRole::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'admin_permissions_role_prepare_save',
6 ['object' => $role, 'request' => $this->getRequest()]
7 );
  • object is an object of \Magento\Authorization\Model\Role
  • request is an object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\User\Controller\Adminhtml\User\Role\SaveRole

admin_system_config_changed_section_currency#

Use cases#

To perform actions after currency symbol is set in admin panel.

Origins#

\Magento\CurrencySymbol\Model\System\Currencysymbol::setCurrencySymbolsData():

Copied to your clipboard
1 public function setCurrencySymbolsData($symbols = [])
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'admin_system_config_changed_section_currency',
6 ['website' => $this->_websiteId, 'store' => $this->_storeId]
7 );
  • website is a website ID
  • store is a store ID

Classes raising the event#

  • \Magento\CurrencySymbol\Model\System\Currencysymbol

admin_system_config_changed_section_currency_before_reinit#

Use cases#

To perform actions before admin configuration reinitialized.

Origins#

\Magento\CurrencySymbol\Model\System\Currencysymbol::setCurrencySymbolsData():

Copied to your clipboard
1 public function setCurrencySymbolsData($symbols = [])
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'admin_system_config_changed_section_currency_before_reinit',
6 ['website' => $this->_websiteId, 'store' => $this->_storeId]
7 );
  • website is a website ID
  • store is a store ID

Classes raising the event#

  • \Magento\CurrencySymbol\Model\System\Currencysymbol

admin_system_config_changed_section_design#

Use cases#

To perform actions after admin design section saved or deleted.

Origins#

  • \Magento\Theme\Model\Design\Config\Plugin::afterSave():

    Copied to your clipboard
    1 public function afterSave(DesignConfigRepository $subject, DesignConfigInterface $designConfig)
    2 {
    3 ...
    4 $this->eventManager->dispatch(
    5 'admin_system_config_changed_section_design',
    6 ['website' => $website, 'store' => $store]
    7 );
  • \Magento\Theme\Model\Design\Config\Plugin::afterDelete():

    Copied to your clipboard
    1 public function afterDelete(DesignConfigRepository $subject, DesignConfigInterface $designConfig)
    2 {
    3 ...
    4 $this->eventManager->dispatch(
    5 'admin_system_config_changed_section_design',
    6 ['website' => $website, 'store' => $store]
    7 );
  • website is an object of \Magento\Store\Api\Data\WebsiteInterface

  • store is an object of \Magento\Store\Api\Data\StoreInterface

Classes raising the event#

  • \Magento\Theme\Model\Design\Config\Plugin

admin_system_config_save#

Use cases#

To perform actions after admin configuration is saved.

Origins#

\Magento\Config\Controller\Adminhtml\System\Config\Save::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'admin_system_config_save',
6 ['configData' => $configData, 'request' => $this->getRequest()]
7 );
  • configData is a data array
  • request is an object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\Config\Controller\Adminhtml\System\Config\Save

admin_user_authenticate_after#

Use cases#

To perform actions after a user is authenticated.

Origins#

  • \Magento\User\Model\User::authenticate():

    Copied to your clipboard
    1
    2 public function authenticate($username, $password)
    3 {
    4 ...
    5 $this->_eventManager->dispatch(
    6 'admin_user_authenticate_after',
    7 ['username' => $username, 'password' => $password, 'user' => $this, 'result' => $result]
    8 );
  • \Magento\User\Model\User::performIdentityCheck():

    Copied to your clipboard
    1public function performIdentityCheck($passwordString)
    2{
    3...
    4 $this->_eventManager->dispatch(
    5 'admin_user_authenticate_after',
    6 [
    7 'username' => $this->getUserName(),
    8 'password' => $passwordString,
    9 'user' => $this,
    10 'result' => $isCheckSuccessful
    11 ]
    12 );
  • username is a username string

  • password is a password string

  • user is an object of \Magento\User\Model\User

  • result is a boolean value

Classes raising the event#

  • \Magento\User\Model\User

admin_user_authenticate_before#

Use cases#

To perform actions before a user is authenticated.

Origins#

\Magento\User\Model\User::authenticate():

Copied to your clipboard
1 public function authenticate($username, $password)
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'admin_user_authenticate_before',
6 ['username' => $username, 'user' => $this]
7 );
  • username is a username string
  • user is an object of \Magento\User\Model\User

Classes raising the event#

  • \Magento\User\Model\User

amazon_customer_authenticated#

Use cases#

To perform actions before an Amazon user is authenticated.

Origins#

\Amazon\Login\Helper\Session::dispatchAuthenticationEvent():

Copied to your clipboard
1 protected function dispatchAuthenticationEvent()
2 {
3 $this->eventManager->dispatch('amazon_customer_authenticated');
4 }

Used in functions:

Copied to your clipboard
1 public function loginById($customerId)
2 {
3 $this->dispatchAuthenticationEvent();
4 ...
5
6 public function login(CustomerInterface $customerData)
7 {
8 $this->dispatchAuthenticationEvent();
9 ...

Classes raising the event#

  • \Amazon\Login\Helper\Session

amazon_login_authorize_error#

Use cases#

To handle an Amazon login exception.

Origins#

\Amazon\Login\Controller\Login\Authorize::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ..
4 $this->_eventManager->dispatch('amazon_login_authorize_error', ['exception' => $e]);
5 }
  • exception is an object of Magento\Framework\Exception\ValidatorException or \Exception

Classes raising the event#

  • \Amazon\Login\Controller\Login\Authorize

amazon_login_authorize_validation_error#

Use cases#

To handle a ValidatorException Amazon login exception.

Origins#

\Amazon\Login\Controller\Login\Authorize::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ..
4 $this->_eventManager->dispatch('amazon_login_authorize_validation_error', ['exception' => $e]);
5 }
  • exception is an object of Magento\Framework\Exception\ValidatorException

Classes raising the event#

  • \Amazon\Login\Controller\Login\Authorize

amazon_payment_authorize_before#

Use cases#

To perform actions before Amazon authorizes a payment.

Origins#

\Amazon\Payment\Gateway\Request\AuthorizationRequestBuilder::build():

Copied to your clipboard
1 public function build(array $buildSubject)
2 {
3 ..
4 $transport = new DataObject($data);
5 $this->eventManager->dispatch(
6 'amazon_payment_authorize_before',
7 [
8 'context' => 'authorization',
9 'payment' => $paymentDO->getPayment(),
10 'transport' => $transport
11 ]
12 );
13 }
  • context is a string authorization
  • payment is an object of Magento\Payment\Model\InfoInterface
  • transport is a DataObject object

Classes raising the event#

  • \Amazon\Payment\Gateway\Request\AuthorizationRequestBuilder

amazon_payment_pending_authorization_hard_decline_after#

Use cases#

To perform actions before a hard decline of Amazon payment.

Origins#

\Amazon\Payment\Model\PaymentManagement\Authorization::hardDeclinePendingAuthorization():

Copied to your clipboard
1 protected function hardDeclinePendingAuthorization(...)
2 {
3 ..
4 $this->eventManager->dispatch(
5 'amazon_payment_pending_authorization_hard_decline_after',
6 [
7 'order' => $order,
8 'pendingAuthorization' => $pendingAuthorization,
9 ]
10 );
11 }
  • order is an object of \Magento\Sales\Api\Data\OrderInterface
  • pendingAuthorization is an object of \Amazon\Payment\Api\Data\PendingAuthorizationInterface

Classes raising the event#

  • \Amazon\Payment\Model\PaymentManagement\Authorization

amazon_payment_pending_authorization_soft_decline_after#

Use cases#

To perform actions before a soft Amazon payment decline.

Origins#

\Amazon\Payment\Model\PaymentManagement\Authorization::softDeclinePendingAuthorization():

Copied to your clipboard
1 protected function softDeclinePendingAuthorization(...)
2 {
3 ..
4 $this->eventManager->dispatch(
5 'amazon_payment_pending_authorization_soft_decline_after',
6 [
7 'order' => $order,
8 'pendingAuthorization' => $pendingAuthorization,
9 ]
10 );
11 }
  • order is an object of \Magento\Sales\Api\Data\OrderInterface
  • pendingAuthorization is an object of \Amazon\Payment\Api\Data\PendingAuthorizationInterface

Classes raising the event#

  • \Amazon\Payment\Model\PaymentManagement\Authorization

assigned_theme_changed#

Use cases#

To perform actions after an assigned theme changed.

Origins#

\Magento\Theme\Observer\CheckThemeIsAssignedObserver::execute():

Copied to your clipboard
1 public function execute(EventObserver $observer)
2 {
3 ..
4 $this->eventDispatcher->dispatch('assigned_theme_changed', ['theme' => $theme]);
5 }
  • theme is an object of \Magento\Framework\View\Design\ThemeInterface

Classes raising the event#

  • \Magento\Theme\Observer\CheckThemeIsAssignedObserver

assign_theme_to_stores_after#

Use cases#

To perform actions after a new theme is assigned to a store.

Origins#

\Magento\Theme\Model\Config::assignToStore():

Copied to your clipboard
1 public function assignToStore(...)
2 {
3 ..
4 $this->_eventManager->dispatch(
5 'assign_theme_to_stores_after',
6 ['stores' => $stores, 'scope' => $scope, 'theme' => $theme]
7 );
8 }
  • stores is an array of stores
  • scope - scope value defined in \Magento\Store\Model\ScopeInterface
  • theme is an object of \Magento\Framework\View\Design\ThemeInterface

Classes raising the event#

  • \Magento\Theme\Model\Config

backend_auth_user_login_failed#

Use cases#

To perform actions after a backend login attempt has failed.

Origins#

\Magento\Backend\Model\Auth::login():

Copied to your clipboard
1 public function login($username, $password)
2 {
3 ..
4 } catch (PluginAuthenticationException $e) {
5 $this->_eventManager->dispatch(
6 'backend_auth_user_login_failed',
7 ['user_name' => $username, 'exception' => $e]
8 );
9 throw $e;
10 } catch (\Magento\Framework\Exception\LocalizedException $e) {
11 $this->_eventManager->dispatch(
12 'backend_auth_user_login_failed',
13 ['user_name' => $username, 'exception' => $e]
14 );
15 }
  • user_name - username string
  • exception is an object of \Magento\Framework\Exception\LocalizedException or \Magento\Framework\Exception\Plugin\AuthenticationException

Classes raising the event#

  • \Magento\Backend\Model\Auth

backend_auth_user_login_success#

Use cases#

To perform actions after a successful backend login attempt.

Origins#

\Magento\Backend\Model\Auth::login():

Copied to your clipboard
1 public function login($username, $password)
2 {
3 ..
4 $this->_eventManager->dispatch(
5 'backend_auth_user_login_success',
6 ['user' => $this->getCredentialStorage()]
7 );
8 }
  • user is an object of \Magento\Backend\Model\Auth\Credential\StorageInterface

Classes raising the event#

  • \Magento\Backend\Model\Auth

backend_block_widget_grid_prepare_grid_before#

Use cases#

To perform actions before a backend grid is prepared.

Origins#

\Magento\Backend\Block\Widget\Grid::_prepareGrid():

Copied to your clipboard
1 protected function _prepareGrid()
2 {
3 $this->_eventManager->dispatch(
4 'backend_block_widget_grid_prepare_grid_before',
5 ['grid' => $this, 'collection' => $this->getCollection()]
6 );
7 }
  • this is an object of \Magento\Backend\Block\Widget\Grid
  • collection is an object of \Magento\Framework\Data\Collection

Classes raising the event#

  • \Magento\AdvancedSearch\Block\Adminhtml\Search\Grid
  • \Magento\Newsletter\Block\Adminhtml\Subscriber\Grid

braintree_googlepay_update_quote_after#

Use cases#

To perform actions after braintree updates a quote.

Origins#

\PayPal\Braintree\Model\GooglePay\Helper\QuoteUpdater::updateQuote():

Copied to your clipboard
1 private function updateQuote(Quote $quote, array $details)
2 {
3 ...
4 $this->eventManager->dispatch('braintree_googlepay_update_quote_after', [
5 'quote' => $quote,
6 'googlepay_response' => $details
7 ]);
8 }
  • quote is an object of \Magento\Quote\Model\Quote
  • googlepay_response is a response array

Classes raising the event#

  • \PayPal\Braintree\Model\GooglePay\Helper\QuoteUpdater

braintree_googlepay_update_quote_before#

Use cases#

To perform actions before braintree updates a quote.

Origins#

  • \PayPal\Braintree\Model\GooglePay\Helper\QuoteUpdater::updateQuote():

    Copied to your clipboard
    1 private function updateQuote(Quote $quote, array $details)
    2 {
    3 $this->eventManager->dispatch('braintree_googlepay_update_quote_before', [
    4 'quote' => $quote,
    5 'googlepay_response' => $details
    6 ]);
    7 }
  • quote is an object of \Magento\Quote\Model\Quote

  • googlepay_response is a response array

Classes raising the event#

  • \PayPal\Braintree\Model\GooglePay\Helper\QuoteUpdater

braintree_paypal_update_quote_after#

Use cases#

To perform actions after Braintree updates a quote.

Origins#

\PayPal\Braintree\Model\Paypal\Helper\QuoteUpdater::updateQuote():

Copied to your clipboard
1 private function updateQuote(Quote $quote, array $details)
2 {
3 ...
4 $this->eventManager->dispatch('braintree_paypal_update_quote_before', [
5 'quote' => $quote,
6 'paypal_response' => $details
7 ]);
8 }
  • quote is an object of \Magento\Quote\Model\Quote
  • paypal_response is a response array

Classes raising the event#

  • \PayPal\Braintree\Model\Paypal\Helper\QuoteUpdater

braintree_paypal_update_quote_before#

Use cases#

To perform actions before Braintree updates a quote.

Origins#

\PayPal\Braintree\Model\Paypal\Helper\QuoteUpdater::updateQuote():

Copied to your clipboard
1 private function updateQuote(Quote $quote, array $details)
2 {
3 $this->eventManager->dispatch('braintree_paypal_update_quote_before', [
4 'quote' => $quote,
5 'paypal_response' => $details
6 ]);
7 }
  • quote is an object of \Magento\Quote\Model\Quote
  • paypal_response is a response array

Classes raising the event#

  • \PayPal\Braintree\Model\Paypal\Helper\QuoteUpdater

catalogrule_dirty_notice#

Use cases#

To perform actions when some catalog rules have changed but changes have not been applied yet.

Origins#

\Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog\Index::execute():

Copied to your clipboard
1 public function execute()
2 {
3 $dirtyRules = $this->_objectManager->create(\Magento\CatalogRule\Model\Flag::class)->loadSelf();
4 $this->_eventManager->dispatch(
5 'catalogrule_dirty_notice',
6 ['dirty_rules' => $dirtyRules, 'message' => $this->getDirtyRulesNoticeMessage()]
7 );
8 }
  • dirty_rules is an object of \Magento\CatalogRule\Model\Flag
  • message is a message string

Classes raising the event#

  • \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog\Index

catalogsearch_reset_search_result#

Use cases#

To perform actions when search results are reset.

Origins#

  • \Magento\CatalogSearch\Model\ResourceModel\Fulltext::resetSearchResults():

    Copied to your clipboard
    1 public function resetSearchResults()
    2 {
    3 ...
    4 $this->_eventManager->dispatch('catalogsearch_reset_search_result');
    5 return $this;
    6 }
  • \Magento\CatalogSearch\Model\ResourceModel\Fulltext::resetSearchResultsByStore():

    Copied to your clipboard
    1 public function resetSearchResultsByStore($storeId)
    2 {
    3 ...
    4 $this->_eventManager->dispatch('catalogsearch_reset_search_result', ['store_id' => $storeId]);
    5

store_id is a store identifier.

Classes raising the event#

  • \Magento\CatalogSearch\Model\ResourceModel\Fulltext

catalogsearch_searchable_attributes_load_after#

Use cases#

To perform actions after searchable attributes get loaded.

Origins#

\Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider::getSearchableAttributes():

Copied to your clipboard
1 public function getSearchableAttributes($backendType = null)
2 {
3 ...
4 $this->eventManager->dispatch(
5 'catalogsearch_searchable_attributes_load_after',
6 ['engine' => $this->engine, 'attributes' => $attributes]
7 );
8 }
  • engine is an object of \Magento\CatalogSearch\Model\ResourceModel\EngineInterface
  • attributes is an array of attributes

Classes raising the event#

  • \Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider

catalog_block_product_list_collection#

Use cases#

To perform actions with a product collection after it is initialized.

Origins#

\Magento\Catalog\Block\Product\ListProduct::initializeProductCollection():

Copied to your clipboard
1 private function initializeProductCollection()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_block_product_list_collection',
6 ['collection' => $collection]
7 );
8 }
  • collection is an object of \Magento\Eav\Model\Entity\Collection\AbstractCollection

Classes raising the event#

  • \Magento\Catalog\Block\Product\ProductList\Random
  • \Magento\Catalog\Block\Product\ProductList\Promotion

catalog_block_product_status_display#

Use cases#

To perform actions when the displayProductStockStatus() function is called.

Origins#

\Magento\Catalog\Block\Product\AbstractProduct::displayProductStockStatus():

Copied to your clipboard
1 public function displayProductStockStatus()
2 {
3 $statusInfo = new \Magento\Framework\DataObject(['display_status' => true]);
4 $this->_eventManager->dispatch('catalog_block_product_status_display'
5 , ['status' => $statusInfo]);
6 return (bool) $statusInfo->getDisplayStatus();
7 }
  • status is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Reports\Block\Product\Compared
  • \Magento\Reports\Block\Product\Widget\Viewed\Item

catalog_category_change_products#

Use cases#

To perform actions after new products get assigned to a category. Assigned products get unassigned, or positions of assigned products are changed.

Origins#

\Magento\Catalog\Model\ResourceModel\Category::_saveCategoryProducts():

Copied to your clipboard
1 protected function _saveCategoryProducts($category)
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_category_change_products',
6 ['category' => $category, 'product_ids' => $productIds]
7 );
8 }
  • category is an object of \Magento\Catalog\Model\Category
  • product_ids is a product IDs array

Classes raising the event#

  • \Magento\Catalog\Model\ResourceModel\Category

catalog_category_delete_after_done#

Use cases#

To perform actions after a category gets deleted.

Origins#

  • \Magento\Catalog\Model\ResourceModel\Category::delete():

    Copied to your clipboard
    1 public function delete($object)
    2 {
    3 $this->getEntityManager()->delete($object);
    4 $this->_eventManager->dispatch(
    5 'catalog_category_delete_after_done',
    6 ['product' => $object, 'category' => $object]
    7 );
    8 return $this;
    9 }
  • product is an object of \Magento\Catalog\Model\Category

  • category is an object of \Magento\Catalog\Model\Category

Classes raising the event#

  • \Magento\Catalog\Model\ResourceModel\Category

catalog_category_flat_loadnodes_before#

Use cases#

To modify a select object before category flat nodes are loaded.

Origins#

\Magento\Catalog\Model\ResourceModel\Category\Flat::_loadNodes():

Copied to your clipboard
1 protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId = 0, $skipMenuFilter = false)
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_category_flat_loadnodes_before'
5 , ['select' => $select]);
  • select is an object of Zend_Db_Select

Classes raising the event#

  • \Magento\Catalog\Model\ResourceModel\Category\Flat

catalog_category_prepare_save#

Use cases#

To modify a category before it is saved.

Origins#

\Magento\Catalog\Controller\Adminhtml\Category\Save::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_category_prepare_save',
6 ['category' => $category, 'request' => $this->getRequest()]
7 );
  • category is an object of \Magento\Catalog\Model\Category
  • request is an object of \Magento\Framework\App\RequestInterface

Classes raising the event#

  • \Magento\Catalog\Controller\Adminhtml\Category\Save

catalog_category_tree_init_inactive_category_ids#

Use cases#

To add more inactive category IDs.

Origins#

  • \Magento\Catalog\Model\ResourceModel\Category\Tree::_initInactiveCategoryIds()

  • \Magento\Catalog\Model\ResourceModel\Category\Flat::_initInactiveCategoryIds():

    Copied to your clipboard
    1 protected function _initInactiveCategoryIds()
    2 {
    3 $this->_inactiveCategoryIds = [];
    4 $this->_eventManager->dispatch('catalog_category_tree_init_inactive_category_ids', ['tree' => $this]);
    5 return $this;
    6 }

tree is an object of \Magento\Catalog\Model\ResourceModel\Category\Tree or \Magento\Catalog\Model\ResourceModel\Category\Flat

Classes that raise the event#

  • \Magento\Catalog\Model\ResourceModel\Category\Tree
  • \Magento\Catalog\Model\ResourceModel\Category\Flat

catalog_controller_category_delete#

Use cases#

To perform actions before a category gets deleted.

Origins#

\Magento\Catalog\Controller\Adminhtml\Category\Delete::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_controller_category_delete', ['category' => $category]);
  • category is an object of \Magento\Catalog\Model\Category

Classes raising the event#

  • \Magento\Catalog\Controller\Adminhtml\Category\Delete

catalog_controller_category_init_after#

Use cases#

To perform actions after a category gets initialized.

Origins#

\Magento\Catalog\Controller\Category\View::_initCategory():

Copied to your clipboard
1 protected function _initCategory()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_controller_category_init_after',
6 ['category' => $category, 'controller_action' => $this]
7 );
  • category is an object of \Magento\Catalog\Model\Category
  • controller_action is an object of \Magento\Catalog\Controller\Category\View

Classes raising the event#

  • \Magento\Catalog\Controller\Category\View

catalog_controller_product_init_after#

Use cases#

To perform actions after a product gets initialized.

Origins#

\Magento\Catalog\Helper\Product::initProduct():

Copied to your clipboard
1 public function initProduct($productId, $controller, $params = null)
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_controller_product_init_after',
6 ['product' => $product, 'controller_action' => $controller]
7 );
  • product is an object of \Magento\Catalog\Model\Product
  • controller_action is an object of \Magento\Framework\App\Action\Action

Classes raising the event#

  • \Magento\Catalog\Helper\Product

catalog_controller_product_init_before#

Use cases#

To perform actions before a product gets initialized.

Origins#

\Magento\Catalog\Helper\Product::initProduct():

Copied to your clipboard
1 public function initProduct($productId, $controller, $params = null)
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_controller_product_init_before',
6 ['controller_action' => $controller, 'params' => $params]
7 );
  • params is an object of \Magento\Framework\DataObject
  • controller_action is an object of \Magento\Framework\App\Action\Action

Classes raising the event#

  • \Magento\Catalog\Helper\Product

catalog_controller_product_view#

Use cases#

To perform actions before a product page is displayed on the frontend.

Origins#

\Magento\Catalog\Helper\Product\View::prepareAndRender():

Copied to your clipboard
1 public function initProduct($productId, $controller, $params = null)
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_controller_product_view', ['product' => $product]);
  • product is an object of \Magento\Catalog\Model\Product

Classes raising the event#

  • \Magento\Catalog\Helper\Product\View

catalog_prepare_price_select#

Use cases#

To modify the way prices are added to a select statement.

Origins#

\Magento\Catalog\Model\ResourceModel\Product\Collection::_preparePriceExpressionParameters():

Copied to your clipboard
1 protected function _preparePriceExpressionParameters($select)
2 {
3 ...
4 $eventArgs = [
5 'select' => $select,
6 'table' => $table,
7 'store_id' => $this->getStoreId(),
8 'response_object' => $response,
9 ];
10
11 $this->_eventManager->dispatch('catalog_prepare_price_select', $eventArgs);
12
  • select is an object of \Magento\Framework\DB\Select
  • table is a table name
  • store_id is a store ID
  • response_object is an object of \Magento\Framework\DataObject

Classes raising the event#

  • \Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection
  • \Magento\Reports\Model\ResourceModel\Product\Downloads\Collection

catalog_product_attribute_update_before#

Use cases#

To perform actions before a product attribute(s) gets updated.

Origins#

\Magento\Catalog\Model\Product\Action::updateAttributes():

Copied to your clipboard
1 public function updateAttributes($productIds, $attrData, $storeId)
2 {
3 $this->_eventManager->dispatch(
4 'catalog_product_attribute_update_before',
5 ['attributes_data' => &$attrData, 'product_ids' => &$productIds, 'store_id' => &$storeId]
6 );
  • attributes_data is a data array
  • product_ids is a product IDs array
  • store_id is a store ID

Classes raising the event#

  • \Magento\Catalog\Model\Product\Action

catalog_product_collection_apply_limitations_after#

Use cases#

To perform actions after product collection limitations have been applied.

Origins#

\Magento\Catalog\Model\ResourceModel\Product\Collection::_applyProductLimitations():

Copied to your clipboard
1 protected function _applyProductLimitations()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_product_collection_apply_limitations_after',
6 ['collection' => $this]
7 );
  • collection is an object of \Magento\Catalog\Model\ResourceModel\Product\Collection

Classes raising the event#

  • \Magento\Reports\Model\ResourceModel\Product\Downloads\Collection
  • \Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection

catalog_product_collection_before_add_count_to_categories#

Use cases#

To perform actions before category counts get added to a product collection.

Origins#

  • \Magento\Catalog\Model\ResourceModel\Product\Collection::addCountToCategories():

    Copied to your clipboard
    1 public function addCountToCategories($categoryCollection)
    2 {
    3 ...
    4 $this->_eventManager->dispatch(
    5 'catalog_product_collection_before_add_count_to_categories',
    6 ['collection' => $this]
    7 );
  • collection is an object of \Magento\Catalog\Model\ResourceModel\Product\Collection

Classes raising the event#

  • \Magento\Reports\Model\ResourceModel\Product\Downloads\Collection
  • \Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection

catalog_product_collection_load_after#

Use cases#

To perform actions after a product collection gets loaded.

Origins#

\Magento\Catalog\Model\ResourceModel\Product\Collection::_afterLoad():

Copied to your clipboard
1 protected function _afterLoad()
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_product_collection_load_after', ['collection' => $this]);
  • collection is an object of \Magento\Catalog\Model\ResourceModel\Product\Collection

Classes raising the event#

  • \Magento\Reports\Model\ResourceModel\Product\Downloads\Collection
  • \Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection

catalog_product_compare_add_product#

Use cases#

To perform actions after a product gets added to a compare list.

Origins#

\Magento\Catalog\Controller\Product\Compare\Add::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_product_compare_add_product', ['product' => $product]);
  • product is an object of \Magento\Catalog\Model\Product

Classes raising the event#

  • \Magento\Catalog\Controller\Product\Compare\Add

catalog_product_compare_item_collection_clear#

Use cases#

To perform actions after a compare list collection gets cleared.

Origins#

\Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection::clear():

Copied to your clipboard
1 public function clear()
2 {
3 $this->_catalogProductCompareItem->clearItems($this->getVisitorId(), $this->getCustomerId());
4 $this->_eventManager->dispatch('catalog_product_compare_item_collection_clear');
5 ...

Classes raising the event#

  • \Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection

catalog_product_compare_remove_product#

Use cases#

To perform actions after a product gets removed from a compare list.

Origins#

\Magento\Catalog\Controller\Product\Compare\Remove::execute(): d

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_product_compare_remove_product',
6 ['product' => $item]
7 );
8 ...
  • product is an object of \Magento\Catalog\Model\Product\Compare\Item

Classes raising the event#

  • \Magento\Catalog\Controller\Product\Compare\Remove

catalog_product_delete_after_done#

Use cases#

To perform actions after a product gets deleted.

Origins#

\Magento\Catalog\Model\ResourceModel\Product::delete():

Copied to your clipboard
1 public function delete($object)
2 {
3 $this->getEntityManager()->delete($object);
4 $this->eventManager->dispatch(
5 'catalog_product_delete_after_done',
6 ['product' => $object]
7 );
8 ...
  • product is an object of \Magento\Catalog\Model\Product

Classes raising the event#

  • \Magento\Catalog\Model\ResourceModel\Product
  • \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel

catalog_product_edit_action#

Use cases#

To perform actions after a product gets edited in admin panel.

Origins#

\Magento\Catalog\Controller\Adminhtml\Product\Edit::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_product_edit_action', ['product' => $product]);
  • product is an object of \Magento\Catalog\Model\Product

Classes raising the event#

  • \Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit\Edit
  • \Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit\Edit

catalog_product_gallery_prepare_layout#

Use cases#

To modify the way a product admin gallery block layout is rendered.

Origins#

\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content::_prepareLayout():

Copied to your clipboard
1 protected function _prepareLayout()
2 {
3 ...
4 $this->_eventManager->dispatch('catalog_product_gallery_prepare_layout', ['block' => $this]);
  • block is an object of \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content

Classes raising the event#

  • \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content

catalog_product_gallery_upload_image_after#

Use cases#

To perform an action after product gallery image gets uploaded.

Origins#

\Magento\Catalog\Controller\Adminhtml\Product\Gallery\Upload::execute():

Copied to your clipboard
1 public function execute()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_product_gallery_upload_image_after',
6 ['result' => $result, 'action' => $this]
7 );
  • result is an array of uploader save data
  • action is an object of \Magento\Catalog\Controller\Adminhtml\Product\Gallery\Upload

Classes raising the event#

  • \Magento\Catalog\Controller\Adminhtml\Product\Gallery\Upload

catalog_product_get_final_price#

Use cases#

To alter the way the final product price is generated.

Origins#

  • \Magento\Catalog\Model\Product\Type\Price::getFinalPrice():

    Copied to your clipboard
    1 public function getFinalPrice($qty, $product)
    2 {
    3 ...
    4 $this->_eventManager->dispatch('catalog_product_get_final_price', ['product' => $product, 'qty' => $qty]);
  • \Magento\Bundle\Pricing\Price\BundleSelectionPrice::getValue():

    Copied to your clipboard
    1public function getValue()
    2{
    3...
    4 $this->eventManager->dispatch(
    5 'catalog_product_get_final_price',
    6 ['product' => $product, 'qty' => $this->bundleProduct->getQty()]
    7 );
  • \Magento\Bundle\Model\Product\Price::getSelectionFinalTotalPrice():

    Copied to your clipboard
    1 public function getSelectionFinalTotalPrice(
    2 $bundleProduct,
    3 $selectionProduct,
    4 $bundleQty,
    5 $selectionQty,
    6 $multiplyQty = true,
    7 $takeTierPrice = true
    8 ) {
    9 ...
    10 $this->_eventManager->dispatch(
    11 'catalog_product_get_final_price',
    12 ['product' => $product, 'qty' => $bundleQty]
    13 );
  • product is an object of \Magento\Catalog\Model\Product

  • qty for quantity float or null

Classes raising the event#

  • \Magento\Bundle\Model\Product\Price
  • \Magento\Downloadable\Model\Product\Price
  • \Magento\GroupedProduct\Model\Product\Type\Grouped\Price

catalog_product_import_bunch_delete_after#

Use cases#

To perform an action after products get deleted.

Origins#

\Magento\CatalogImportExport\Model\Import\Product::_deleteProducts():

Copied to your clipboard
1 protected function _deleteProducts()
2 {
3 ...
4 $this->_eventManager->dispatch(
5 'catalog_product_import_bunch_delete_after',
6 ['adapter' => $this, 'bunch' => $bunch]
7 );
  • adapter is an object of \Magento\CatalogImportExport\Model\Import\Product
  • bunch is a data array

Classes raising the event#

  • \Magento\CatalogImportExport\Model\Import\Product

catalog_product_import_bunch_delete_commit_before#

Use cases#

To perform an action before products get deleted.

Origins#

\Magento\CatalogImportExport\Model\Import\Product::_deleteProducts():

Copied to your clipboard
1 protected function _deleteProducts()
2 {
3 ...
4 $this->_eventManager->dis