I am using an observer with this event customer_register_success
.I want to redirect my new customer to cart after the registration. This is my code from my observer:
$customer = $observer->getEvent()->getCustomer();
if ($customer){ // customer new registration after
//Mage::app()->getResponse()->setRedirect($lastUrl); // This doesn't work
Mage::app()->getFrontController()->getResponse()->setRedirect($lastUrl);
Mage::app()->getResponse()->sendResponse(); // This works but the customer is not logged in.
}
If you check my comments from the code. How can i make the user to be redirected and to be logged in too ?
Thx