So, I'm struggling with this, I've got an observer set up to trigger whenever customer/account/login is hit. Firebug clearly shows that I'm POSTing data to this URL and I'm not able to read said POST data in my observer method.
Observer method:
public function checkCustomerLogin($observer) {
Mage::log("event observed");
$controller = $observer->getControllerAction();
Mage::log(print_r($controller->getRequest()->getPost(), true));
return $this;
}
Example log result:
2014-03-11T11:46:38+00:00 DEBUG (7): event observed
2014-03-11T11:46:38+00:00 DEBUG (7): Array
(
)
My observer is configured to trigger on controller_action_predispatch_customer_account_login
. Clearly I'm doing something wrong here seeing as how I just can't get my POST data (I've tried a few other desperate approaches but from what I can tell this is how you're "supposed" to get a controller and the POST data in an observer method).
instead of controller use app so
instead of
Mage::log(print_r($controller->getRequest()->getPost(), true));
change to
Mage::log(print_r(Mage::app()->getRequest()->getPost(), true));
So that instead of controller you are using $app to get post details.
Use Mage::app()->getRequest()->getParams()
It will return array of all parameters sent to called controller's action
Hope this helps you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With