Finally, I found the solution after digging in the code and spending hours trying to figure out.
Check this good explained tutorial first:
http://webdevster.com/ecommerce/magento/magento-multiple-store-setup-instructions
Environment
1 – Dedicated Server in Amazon EC2, Suse 11 SP1
1 – Apache 2.2.16 + PHP 5.3 + MySQL 5.0
1 – IP address
1 – magento-main.com – virtual host www root directory for main store
1 – magento-2nd.com – virtual host www root directory for 2nd store
1 – Magento Admin Control Panel which is your main store.
Solution
After following all the steps from webdevster.com I was still not able to share the basket. What I added to that tutorial is links sharing the SID (Session Id) to the other domain.
magento-main.com and magento-2nd.com
If you add in the basket (/app/design/frontend/yourtheme/default/template/checkout/cart.phtml) this code in both stores:
<?php
//Get Link to the main Website id=1
$switcher = new Mage_Page_Block_Switch;
if(count($switcher->getGroups())>1) {
foreach ($switcher->getGroups() as $_group) {
if($_group->getId() == 1) { //Default
$link_other_store = $_group->getHomeUrl();
}
}
}
?>
<a href="<?php echo $link_other_store; ?>">
Go to the sister website
</a>
Now, you have a link to switch to the other store. This link will transfer your session so Magento can identify you and shows you all the basket and settings as you have in the other website.
gfxguru
on May 12th, 2011
@ 8:38 am:
This does not work for my on Magento 1.5.1.0 I’m not sure if I missed something here or my configuration of stores differs. The session ID is not passed with the customer to the other store.
admin
on May 12th, 2011
@ 1:35 pm:
I’ve just updated the code, check it out
Thanks!
Ravi Kachhawaha
on Jul 19th, 2011
@ 11:24 am:
HI,
I have used “websites” insted of using “stores” to share cart
My session id is passing between two domains successfully but still my cart is not sharing products. I have tried all the ways to solve it but not getting the solution. Please help me if have any options to solve this issue.
Thanks,
Ravi
Antony
on Jul 28th, 2011
@ 9:06 am:
Hi Ravi
Not sure about 1.5+ but on 1.4.2 (and 1.4) you need to set;
Configuration..Web..Session Validation Settings..Use SID on Frontend= YES
As default all are no. By setting just “Use SID on Frontend= YES” you will get basket sharing between stores. I have this working np.
The ‘only’ problem is that I have had cases of site users seeing other users details – without actually having logged in. My suspicion is that the SID has been indexed someone on Google and the session ‘transferred’. I have tried setting some of the others to Yes – to remove this problem but it breaks a payment gateway…….