How to Access Magento Customer's Session from Outside Magento

How to access Magento customer's session from outside Magento?

You will need to enter in .domain.com in Magentos admin->system->configuration->web->cookie domain. Like erickthered mentioned, you will need to make the cookie available to your other subdomains in order for it to be read. This is the same with all web applications.

Reference: http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/system_config/edit/web#session_cookie_management_field_descriptions

How to access Magento user's session from outside Magento?

I would recommend checking the path of the cookie that Magento sets. Most likely, it is set to /shop, so the cookie will not be accessible to your file above it.

You can modify the path that Magento uses to set its cookie in the control panel under System -> Configuration -> Web (under the General heading) -> Session cookie management

How to Create session for customer login with session outside magento

Sessions are stored in database session table or something like that or, more commonly, in var/session. Depends on the install.

Login user programmatically in magento not working properly?

tells you how to log someone into magento "outside" of the magento. I do think the answer in the link is missing:

Mage::app('mysite');

before running the code. So something like this:

Mage::app('mysite');
$session = Mage::getSingleton( 'customer/session' );
try
{
$session->login( $email, $password );
$session->setCustomerAsLoggedIn( $session->getCustomer() );
return true;
}
catch( Exception $e )
{
//error handling code
}

to create a user look here:
http://inchoo.net/ecommerce/magento/programming-magento/programatically-create-customer-and-order-in-magento-with-full-blown-one-page-checkout-process-under-the-hood/



Related Topics



Leave a reply



Submit