For Magento >= 1.9.2.0:
The event you are looking for is catalog_controller_product_mass_status
, it is dispatched under the massStatusAction
of app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
However this event only provides the ids of the products that are mass updated, which you can retrieve this way in your observer:
$productsIds = $observer->getEvent()->getProductIds();
For Magento >= 1.6.0.0-beta1:
On top of that you can also observe one of the following events (depending on your needs):
catalog_product_attribute_update_before
which is dispatched in the updateAttributes
method of the app/code/core/Mage/Catalog/Model/Product/Action.php
catalog_product_attribute_update_after
which is dispatched in the same location as the previous one
BEWARE: thore events are not only triggered by the mass status action, they are also triggered by other Magento functionalities, use with care.
As the massStatusAction
method calls the following code, those two events will be dispatched:
Mage::getSingleton('catalog/product_action')
->updateAttributes($productIds, array('status' => $status), $storeId);
You can use two two events in your observer this way:
For the first event:
// Get the attribute data
$attributesData = $observer->getEvent()->getAttributesData();
// Get the product ids
$productIds = $observer->getEvent()->getProductIds();
// Get the store id
$storeId = $observer->getEvent()->getStoreId();
For the second one you can only do:
// Get the product ids
$productIds = $observer->getEvent()->getProductIds();
For Magento < 1.6.0.0-beta1:
I guess the last solution here is to observer one the following event: controller_action_predispatch_adminhtml_catalog_product_massStatus
You can use it in your observer this way:
// Get the request
$request = $observer->getEvent()->getControllerAction()->getRequest();
// Get the product ids
$productIds = $request->getParam('product');
// Get the store id
$storeId = (int)$request->getParam('store',0);
// Get the status applied
$status = $request->getParam('status');
Best Answer
If you want to
$productobj
after saving product from backend side so you can easily usecatalog_product_save_after
event.I am assuming that you already know how to create a module in
M2
.Right now you have to need develop new module for M2
Then Create this
events.xml
file in below pathapp\code\YOUR_NAMESPACE\YOURMODULE\etc\adminhtml
And Create your observer file
Productsaveafter.php
in below pathapp\code\YOUR_NAMESPACE\YOURMODULE\Observer\