• In some of our larger Magento EE (Enterprise Edition) setups we have Multiple stores that have different domains. One of the challenges with stores on different domains is sharing sessions. Luckily magento has some built in functionality to be able to pass along a session id as a SID as a query param. This works in conjunction with the users local cookies to make sure the cart is persistent between stores. There are a few ways to go about it but I found that the solution below works pretty well for us.

    First off I think it’s a good idea to take a look at this page for reference. The link below will go over some of the params you can pass to the “Mage:getUrl();” method.

    http://www.magentocommerce.com/wiki/5_-_modules_and_development/reference/geturl_function_parameters

    Welcome back. You read the link above right? Welp if you didn’t it’s cool. I like code examples too. So take a look below.

    TL;DR

    Below you’ll see I am using Mage:getURL(); I am passing along a few parameters.

    $session_id = Mage::getSingleton("core/session")->getEncryptedSessionId(); // get our session
    
    echo Mage::getUrl( '/', array('_store' => $YOUR_STORE_ID,// pass along a store id IF NEEDED
    '_query' => array('SID' => $session_id ), //make sure we append our session
    '_store_to_url' => true ) ); // lastly add store to our url if needed

    Discover more from Linchpin

    Subscribe to get the latest posts sent to your email.