How to redirect custom page after registration in Magento In my custom page having the form if I submit that form ,then it will go to home page

I have verify.phtml


               $isuserVerified = Mage::helper('test/Data')->isUserVerified(Mage::getSingleton('customer/session')->getId());
              if($isuserVerified == 'false'): ?>
        <div class="verify_mobile">
            <?php /*?><div class="notverify_yet">
       <?php echo $this->__('*Please verify your mobile with OTP code.'); ?>

<label class="verify">
    <?php echo $this->__("Please Enter verification codes"); ?>
<input type="text" id="code" name="code" placeholder="Enter verification code" class="verify" />
<input type="button"  id="verify_mobile" value="Verify Mobile" class="button verify" />
<?php if(Mage::helper('test/Data')->canResendOTP())
    { ?>
<a href="#" id="resend_mobile_code" class="verify resendcode">Resend Code</a>
<?php } ?>

                    <script type="text/javascript">
                 jQuery(document).ready(function(e) {

    jQuery('#verify_mobile').click(function(e) {
        var code = jQuery("#code").val();
        if(code !== ""){
                url:'<?php echo Mage::getBaseUrl().'test/index/checkMobileVerificationCode' ?>',
                success: function(data) {

                    if(data !== "false"){
                        showMessage('Thanks for Verification', "success");
                      showMessage('Please Enter Valid Code!', "error"); 
                error: function() {
                    alert('Error occured');

    jQuery('#resend_mobile_code').click(function(e) {
        var code = jQuery("#code").val();

            url:'<?php echo Mage::getBaseUrl().'test/index/resendMobileCode' ?>',
            success: function(data) {

                showMessage(data, "success");
            error: function() {
                showMessage('Something went wrong', "error");

    function showMessage(txt, type) {
        var html = '<ul class="messages"><li class="'+type+'-msg"><ul><li><span>' + txt + '</span></li></ul></li></ul>';


I want to call this page(verify otp) after successful registration and after successful verification otp it will go to home page.

I tried with create custom module observer

class Tst_Custommodule_Model_Observer {
    public function myredirection(Varien_Event_Observer $observer) {
    //echo "fsdffds";exit;
    $AccountController = $observer->getEvent()->getAccountController();

    $Customer = $observer->getEvent()->getCustomer();

     $response1 = Mage::app()->getResponse(); // observers have event args

        $url = 'numberverify';


but it gets error cannot save customer

  • Do You have a seperate form or you are talking about the customer registration form provided by magento? Please share your problem in more detail with code snippet if possible. This will help you get answers faster. – aton1004 Nov 10 '17 at 8:29
  • Iam having verifiacation code form – User0434 Nov 10 '17 at 8:31
  • So you have a custom form and on form submission you want to redirect it to home page? Is that what you want? – aton1004 Nov 10 '17 at 8:32
  • yes for submission of registration it will go to my custom form and then it will go to homepage – User0434 Nov 10 '17 at 8:37
  • Could you please update your question with screenshots on what is happening right now and what you want to achieve? Your comments are not helping at all, sorry :( – aton1004 Nov 10 '17 at 8:40

You can use following code in your observer which will observe event customer_register_success


For redirecting back to home page you can use following in you form's submit controller you can use following code ;

  • can you give the proper answer – User0434 Nov 10 '17 at 8:31

If I get you correctly, On customer registration success you want your customer to be redirected to the page with template verify.phtml. When the verification is successful you want them to be redirected to Home page.

For this I think you should follow below steps:

  1. override customer create Action of Account controller, some information could be found here
  2. On the controller action you need to set the redirect to your customer module controller which will load the layout that has a block with your template of verify.phtml

I think point 2 may confuses you. So let me explain a bit more in detail.

First of all you need your own module with a controller. in that controller You will load and render a layout with template. Refer this

Now on the same module you could override the customer controller with create Action. And there after customer is created, you can redirect to your controller by doing something like


You can search more detail about redirecting to our custom module controller.

On the verify form submission success, which you are doing through ajax, you can redirect easily to your home page.

I hope my answer above provide you some giudelines to move ahead. If it helps you please accept and vote up the answer.

Happy Coding!!

  • can you give steps in sample code – User0434 Nov 10 '17 at 12:20

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.