-1

Can i redirect from observer in Magento?

admin_session_user_login_success

Here I am checking session and if the session is already created then redirect to same page otherwise redirect to home page

If yes then how? Please suggest code

Bouke
  • 11,768
  • 7
  • 68
  • 102
Yogesh Karodiya
  • 225
  • 5
  • 15
  • Have you checked these? http://stackoverflow.com/questions/16824551/ http://stackoverflow.com/questions/13236912/ http://stackoverflow.com/questions/16535481/ – Amal Murali Aug 09 '13 at 06:05
  • Why do you have to do that anyway? seems like a train wreck waiting to happen. – Seth Malaki Aug 09 '13 at 06:09

1 Answers1

1

try something like this:

   $controller = Mage::app()->getRequest()->getControllerAction();
   $controller->getRequest()->setDispatched(true);
   $controller->getResponse()->setRedirect(Mage::app()->getRequest()>getServer('HTTP_REFERER'));
   $controller->getResponse()->sendResponse();

Good luck! May the force be with you.

Michael Leiss
  • 5,395
  • 3
  • 21
  • 27