Question

I have added a massaction to the sales order grid in Magento 2. I want to pass on the POST data (the checked orders) to my custom controller/page which is setup and working as expected.

How do I retrieve the POST data in my controller or on the page. I searched allot but cannot find tutorials or examples. I know i can do $this->getRequest()->getPost(). But that only applies when the action is extending Magento\Framework\App\Action\Action but as far as I know this is only for frontend actions. My class is extending \Magento\Backend\App\Action as it needs to be a backend action.

Any extensive documentation or other resources on this topic would also be great!

EDIT: This was follow up question in looking for an answer. It might help users with the same problem: Magento 2 how to pass order id's from sales order grid to my module controller

Était-ce utile?

La solution

$this->getRequest()->getParams(); will get you the post data. If you want to access a specific parameter you can use $this->getRequest()->getParam('something'); I have tested this on an admin controller and it will work when extending \Magento\Backend\App\Action

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top