Magento – how to pass data from one controller’s action to another controller’s action in magento

magento-1.9

I have created a custom controller in my module and i want to pass data from one controller's action to another controller's action, but how can i do it may know the proper syntax ?

$params = array('order_ids' => $ids);
$this->_redirect('adminhtml/OrderController/pdfinvoices', array('_query' => $params));

I am trying this is it possible in magento?

Best Answer

you can implement this by using following syntax.

1) Redirecting controller's action.

public function sayHelloAction() {
        $params = array('order_ids' => $ids);
        $this->_redirect('demo/tester/sayDemo', array('_query' => $params));
    }

2) Redirected controller.

public function sayDemoAction() {
        $para = $this->getRequest()->getParams();
        echo '<pre>';
        print_r($para);
        echo "Hello World Tester!";
        exit;
    }

Hope this will help you.

Related Topic