0

I have one Magento website, with 6 different stores and 1 storeview per store.

They all have different domainnames, except one, which is a subdomain of one of the stores, like this:

  • domain1.nl
  • subdomain.domain1.nl
  • domain2.nl
  • domain3.nl
  • domain4.nl
  • domain5.nl

At this moment the logged in users can only switch between domain1.nl and subdomain.domain1.nl, without automatically logging out. Also the cart is shared between these two stores. The users or cart are not shared with the other stores (domains).

I have already tried the following:

  • In System -> Configuration -> Customer Configuration -> Share Customer Accounts, I have set it to GLOBAL
  • I have tried 3 possible store configurations, which were quoted at different topics regarding the same problem:

    • If your websites are located in one domain, but in different directories, e.g. "www.example.com/stores/store1" and "www.example.com/stores/store2" you can setup your "Cookie Path" to "/stores/" in System -> Configuration -> Web -> Session Cookie Management.
    • If your websites are located in different sub-domains e.g. "store1.example.com" and "store2.example.com" you can setup "Cookie Domain" to ".example.com" in System -> Configuration -> Web -> Session Cookie Management.
    • If you have different domains, in this case you can add session ID to the URL for another store. Use this construction "Mage::getModel('core/url')->addSessionParam()->getUrl('...')" to get the URL with session parameter. This is probably the one I need, but I do not know where and how to implement this. I have added it to my header.phtml file which has a storeswitcher
  • At the moment my System -> Configuration -> Web -> Session Cookie Management:
    cookiepath: /
    cookie domain: empty

  • Use SID in frontend is set to: YES

  • I have tried Marius's 'Share Carts Between Websites' module: http://marius-strajeru.blogspot.nl/2013/01/share-cart-between-websites.html

Any help is appreciated

I am using Magento 1.9.2.2

1 Answer 1

0

I solved this by using the following code in my storeswitcher.phtml

if (isset($_GET['SID']))
    {
        $this->setSessionId($_GET['SID']);
        session_decode(file_get_contents(Mage::getBaseDir('session') . '/sess_' . $_GET['SID']));
       setcookie('lastsid', $_GET['SID']);
     $_COOKIE['lastsid'] = $_GET['SID'];
$session_id = $_COOKIE['lastsid'];

    }
    else
    {
$session_id =  Mage::getSingleton('core/session')->getEncryptedSessionId();

    }

and add the $session_id variable in the link later on:

 <li ><i class="icon-ok theme-color"></i>
     <a href="<?php echo $store_1->getBaseUrl()."?SID=".$session_id;?>"><?php echo $logo_alt;?> </a></li>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.