0

I am new to magento,using 1.9.2.4. I have the module of OTP verification and it's working fine. Whenever login, it redirects to dashboard page and ask to enter verification code.The code in dashboard.phtml is like,

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('test/numberverify.phtml')->toHtml(); ?>

so it was asked in dashboard.pthml, but I want to keep this code after register, then this page will appear and then verify after it will redirect to dashboard.phtml. Which files I need to change and how to do this?

numberverify.phtml

                 <?php 

             $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"); ?>
</label>
<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 !== ""){
            jQuery.ajax({
                method:"POST",
                url:'<?php echo Mage::getBaseUrl().'test/index/checkMobileVerificationCode' ?>',
                data:{code:code}, 
                success: function(data) {

                    if(data !== "false"){
                        jQuery(".verify_mobile").css('display','none');
                        showMessage('Thanks for Verification', "success");
                    }
                    else
                    {
                      showMessage('Please Enter Valid Code!', "error"); 
                    }
                },
                error: function() {
                    alert('Error occured');
                }
            });
        }
    }); 

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

        jQuery.ajax({
            method:"POST",
            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>';
        jQuery('ul.messages').remove();
        jQuery('.page-title').after(html);
    }

});

0

PM

Go TO This File: app/design/frontend/customtheme/default/template/persistent/customer/form/register.phtml

Copy code from tag close or after close tag.

 echo this->getLayout()->createBlock('core/template')->setTemplate('test/numberverify.phtml')->toHtml();

Note: Customtheme name will be your theme.

  • iam using rwd theme path:app/design/frontend/rwd/default/template/test/customer/form/register.phtml – Nadh Nov 9 '17 at 6:03
  • Go TO This File: app/design/frontend/rwd/default/template/persistent/customer/form/register.phtml – Sourav Nov 9 '17 at 6:04
  • iam using custom code in app/design/frontend/rwd/default/template/test/customer/‌​form/register.phtml ,i want after click on register numberverify.phtml page will call – Nadh Nov 9 '17 at 6:07
  • ok do you want after register button click customers will redirect to Otp page? – Sourav Nov 9 '17 at 6:14
  • yes after register button click customers will redirect to numberverify.phtml and then verify otp it will go to home page or myaccount page @Paarth – Nadh Nov 9 '17 at 6:15

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.