Question

I created a custom register-trade.phtml for trade customer signups that I am pulling into a CMS page.

The issue is if a customer enters something wrong e.g. their email is already in use it redirects to /customer/account/create/ and shows the normal register form.

This form is different, has different fields and ultimately will not sign the user up in the trade group.

Can I redirect to the trade register page and display the error rather than going to /customer/account/create/ ?

Was it helpful?

Solution

Take a look at:

app/code/core/Mage/Customer/controllers/AccountController.php

Copy that file to the local code pool and amend the _loginPostRedirect() function.

Change this line to do something else:

$session->setBeforeAuthUrl( $this->_getHelper('customer')->getLoginUrl());

Basically that line sets the redirect to the standard login page if the customer login does not work. You can change that to go back to the previous page, e.g.:

 $this->_redirectUrl($session->getBeforeAuthUrl(true))

Whether that will work given the many login routes you have I do not know, however, this should get you on the right track for what you are trying to achieve. Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top