I've a href link on product page which link to a measurement form in customer's dashboard. If customer is logged in, measurement form will appear otherwise it will redirect to login page. Once customer logs in again it should re-direct to my measurement form.

In measurement form I've condition Mage::getModel('customer/session')->isLoggedIn() and showing form or re-direction them to login page based on whether they are logged-in or not. When they are re-directed to login page and logs-in how I can re-direct them again to measurement form in this particular case?
Note: I don't want to re-direct them to measurement form if they are logging-in from any other place like wishlist, checkout etc.

  • 2
    Store the information that the customer is coming from the measurement form the session and then use the information to decide after login (in observer) whether to redirect to the form or not. Oct 15, 2015 at 7:32

1 Answer 1


Redirect url

$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$param = Mage::helper('core')->urlEncode($currentUrl);
$url = Mage::getUrl('customer/account/login', array(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME => $param);
  • I've added it in else condition of my form. It's redirecting to login page but after logging-in it's taking me to customer dashboard page.
    – amitshree
    Oct 15, 2015 at 8:52
  • debug Mage_Customer_AccountController line 190 line
    – altdovydas
    Oct 15, 2015 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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