-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Description
I want to redirect to my page after I saved a product in the back-end. So, I used the "controller_action_postdispatch_catalog_product_save" event but it didn't work for me.
Could you please let me know what was wrong with this code?
public function adminhtmlCatalogProductSaveAfter(EventObserver $observer) {
$action = $observer->getEvent()->getControllerAction();
$action->getActionFlag()->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
$this->messageManager->addSuccess(__('You saved the product.'));
$action->getResponse()->setRedirect(
$action->getUrl('myrouter/index/index')
);
}
Metadata
Metadata
Assignees
Labels
No labels