Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By salimmohd82 on
I tried to execute this code from hook_user_login
require_once $_SERVER['DOCUMENT_ROOT'] . "/mage1/app/Mage.php";
umask(0);
Mage::App('default');
$session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
try {
$session->login('alvaro@test.com', 'cec123');
$session->setCustomerAsLoggedIn($session->getCustomer());
header('Location: http://'.$_SERVER[SERVER_NAME].'/mage1/customer/account/?SID='.$session->getSessionId());
} catch (Exception $e) {
print_r($e);
exit;
}
But not able to log-in to magento and it automatically logs out of Drupal.
But if i run this code separately in a simple php page it logs into magento
I user D7 and Mage 1.7
Comments
I have same issue
Hello ,
Have you got any solution on above ?
Module
Are you executing this code inside a module? What hooks are you implementing?
Have you looked for existing solutions?
https://www.drupal.org/project/magento_integration
--
Read more at iRolo.net