cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Share session between stores with different domains

Problem with Share session between stores with different domains

I am trying to share session between 2 stores, each store have a domain distinct. domain1.com store 1, domain2.com store 2,

domain1.com -> store1 -> root/domain1.com/html/
domain2.com -> store2 -> root/domain1.com/html/domain2

I used SID in URL but this not work when the customer open domain directly,

I used cross-domain but this not work in Safari or explorer with problem of cookies.

I used cookie path : / 
I used Cookie domain: domain1.com (the main) , but when I set this, the cart and session of domain2.com not work. (withou logs of errors)

Does anyone know which method uses this site? (yoyo.com , diapers.com), these is websites that share session without problem.

I used Magento 1.8

3 REPLIES 3

Re: Problem with Share session between stores with different domains

Hi @richicasas,

 


More than a week has passed since you created this post.
Were you able to find a solution?

 

 

Best regards,

Gabriel

Welcome to the Magento Forums. Remember to introduce yourself and read the Magento Forums Guidelines.

Re: Problem with Share session between stores with different domains

I still can not find the solution. 

Temporarily place the SID in the URL for when the customer wants to switch between stores and this works perfectly.

But if the customer enters directly into each domain the carts are still not shared.

Re: Problem with Share session between stores with different domains

@richicasas Did you ever find a solution for your issue?

 

If i've adding SID parameter to the url , it is working normally and share the cart between sites?

Below an example to put SID in URL,, it's correct? i'm not tested yet.

  <select onchange="document.location=this.options[selectedIndex].value">
  <?php
    $session = Mage::getSingleton('core/session');
    $SID = $session->getEncryptedSessionId(); //current session id
    $websites = Mage::getModel('core/website')->getCollection();
  
    foreach($websites as $website) {
      
      $default_store = $website->getDefaultStore();
                $model_url = new Mage_Core_Model_Url();
                $store_basepath = $model_url->getBaseUrl( 
        array( '_store'=> $default_store->getCode())
      ).'?SID='.$SID;
  ?>
        <option <?php if ( strstr($this->helper('core/url')->getCurrentUrl(), $store_basepath) ) : ?> selected="selected" <?php endif; ?> value="<?php echo $store_basepath ?>"><?php echo $website->getName()?></option>
  <?php
    }
  ?>
</select>