开发者

Sugarcrm magento common login

开发者 https://www.devze.com 2023-02-09 05:33 出处:网络
I\'m integrating SugarCRM and Magento. My requirement is when I click on a link in SugarCRM it should redirect 开发者_StackOverflow社区to the Magento admin panel order creation. Moreover when I redire

I'm integrating SugarCRM and Magento. My requirement is when I click on a link in SugarCRM it should redirect 开发者_StackOverflow社区to the Magento admin panel order creation. Moreover when I redirect to Magento it should not ask me for Login.

How can I do that?


Seamless login into Sugar is pretty straight forward. Below is an example that creates a link that bypasses Sugar login. When you login to Magento, you can login to Sugar and store the Sugar session variable in a server session variable or a Global variable. Here's the format of a SugarCRM URL

'http://localhost:8080/XXX/index.php?module=Accounts&action=DetailView&record=927e722c-0d8a-e6b1-c590-4c9bb6c4e34b$MSID

  1. http://localhost:8080/XXX/index.php - URL
  2. module=Accounts (Module name you want to link to
  3. action=DetailView (You can go to either the DetailView or EditView)
  4. record=927e722c-0d8a-e6b1-c590-4c9bb6c4e34b (Sugar ID record number)
  5. MSID=3979359348 (Session variable obtained after the seamless login)

You will have to extend Magento to add this information to a link. If you store the MSID in a session variable, then you could always append $_SESSION['MSID'] to the URL

$user_name="admin";
$user_password="admin";


$soapClient = new SoapClient(NULL,
array(
"location" => 'http://localhost:8080/XXX/soap.php',
"uri" => 'http://localhost:8080/XXX',
)
);

try {
    $info = $soapClient->login(
    array(
    'user_name' => $user_name,
    'password'  => md5($user_password),
    )
    );
}
catch (SoapFault $fault) {
    die("Sorry, the service returned the following ERROR: ".$fault->faultcode."-".$fault->faultstring.".");
}

$session = $info->id;

$canlogin = $soapClient->seamless_login($session);
$MSID='';
if ($canlogin == 1)
$MSID =  "&MSID=" . $session;





//echo "Successful Login! Session ID {$session}<br>";

echo "<a href='http://localhost:8080/XXX/index.php?module=Accounts&action=DetailView&record=927e722c-0d8a-e6b1-c590-4c9bb6c4e34b$MSID'>Account Name</a>";

Kaz


I haven't used SugarCRM in particular before, but the general gist of these solutions are to keep the two user databases in sync (same usernames and passwords). Then, when the user logs into one system, send a request to the other system to log in at the same time.

0

精彩评论

暂无评论...
验证码 换一张
取 消