1

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

1 Answer 1

2

This piece of code did the job:

 Mage::getSingleton('customer/session')->setBeforeAuthUrl($lastUrl);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.