1

I want to add Mobile number field to customer registration form. So that user can login with help of email id or mobile number.

https://www.magentocommerce.com/magento-connect/custome-account-profile-13594.html

I have tried this extension but it shows me an error.

I have tried creating simple custom extension "Hello World" but don't have experience to write any useful extension .

Can you please give some idea related to my requirement?

1

1 Answer 1

1

1- You have to create the attribute phone_number and then display it for the customer in register.phtml and edit.phtml, you have to follow this tuto

2- You have to Rewritte loginPostAction() from AccountController.php to your local codepool, you can follow this tuto and then you add this piece of code in loginPostAction():

if (strpos($login['username'], '@') === false){ //the user has entred a phone number
          $telUser = $login['username'];
          $customer = Mage::getModel('customer/customer')->getCollection()
                       ->addAttributeToFilter('phone_number', $telUser)
                       ->getFirstItem();
          if($telUser == $customer->getPhoneNumber()){
              $login['username'] = $customer->getEmail();
          }
    }
4
  • Thank you for the response, I have follow the step 1 steps but unable to find whether the mobile number is store in db or not, how can i check for that? Apr 10, 2017 at 10:28
  • Have you a phone_number field in customer tab in backoffice ?
    – PЯINCƎ
    Apr 10, 2017 at 10:36
  • sorry i don't get your point, i have just follow same step mention there in first link Apr 10, 2017 at 10:40
  • I dont know what this extension have like code !, however if you dont have your custom field phone_number(see how you named it), it's that it doesn't work. I suggest you to follow my answer for step 1 and then step 2.
    – PЯINCƎ
    Apr 10, 2017 at 10:48

Your Answer

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

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