Netsuite's SuiteCommerce Advance:: Social SignUp(FaceBook, Google+)

420 Views Asked by At

I need to integrate Social Sign-up/Login in our SuiteCommerce Advance Site, Anyone knows ho we can do that? Help would be Appreciates. Our SuiteCommerce verion is Vension 2016.

2

There are 2 best solutions below

0
On BEST ANSWER

I managed to do this after searching for 1 days you need to make change only for login and register page

Register With Facebook--> This simply will use FB details paste it on current input boxes and auto click on submit button

File Path--> [email protected]/Templates/login_register_register.tpl

Code-->

<!-- Code Button to get The Login With Fb -->
<fb:login-button scope="public_profile,email" id="facebook-reg" onlogin="checkLoginState();">
Sign Up With Facebook
</fb:login-button>

<script>
  function statusChangeCallback(response) {
    if (response.status === 'connected') {
      GetFbUserDetails();
    } else if (response.status === 'not_authorized') {
      document.getElementById('status').innerHTML = 'Please log ' +
        'into this app.';
    } else {
      document.getElementById('status').innerHTML = 'Please log ' +
        'into Facebook.';
    }
  }
  function checkLoginState() {
        document.getElementById("fblogin").innerHTML="Processing..";
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  }
  window.fbAsyncInit = function()
    {
  FB.init({
    appId      : 'your-app-id',
    cookie     : true,  // enable cookies to allow the server to access
                        // the session
    xfbml      : true,  // parse social plugins on this page
    version    : 'v2.6' // use graph api version 2.8
  });
  FB.getLoginStatus(function(response)
    {
    statusChangeCallback(response);});
  };

    (function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

  function GetFbUserDetails()
    {
            FB.api('/me?fields=id,email,first_name,last_name', function(response)
            {
                     var fname = document.getElementById('register-firstname');
                     fname.value = response.first_name;

                     var lname = document.getElementById('register-lastname');
                     lname.value = response.last_name;

                     var email = document.getElementById('register-email');
                     email.value = response.email;

                     var pass = document.getElementById('register-password');
                     pass.value = response.id;

                     var pass2 = document.getElementById('register-password2');
                     pass2.value = response.id;
                     if(pass!=="" && pass2!=="")
                     {
                        document.getElementById('facebook').click();
                     }
    }  );
}

Login With Facebook--> You can use same code to get this done..

Let me know Your comments on this

0
On

Anup, you cannot insert javascript inside handlebars, it's not supported.

As for the original question, web store user registration is done through the session.registerCustomer function. It does not currently support Facebook SSO. There are some protocols that Netsuite supports but they are for logging in to the backend from a different application.