1
votes

i am a new to magento what i am trying to do is share Shopping cart among different stores and there respective websites, I have already implemented the solution provided in this post, Magento multiple websites share shopping cart, which works but have a limitation,

The Limitation which also is a problem in my case is that if something is 1st added to cart from ROOT category , it remains in session even we switch store(all stores have different ROOT category), also items added from other stores also share same cart session. BUT when i add something to cart from any other Store(Non Default Store) and then move to other stores, Cart Session for every store is created independently(mean there sessions are not shared). Now i wanna know what am i doing wrong here or what must i do to share there sessions.?

2

2 Answers

0
votes

Give this a try. I's something I developed for a project on Magento EE 1.12, but it should work on CE also. Magento already shares the cart between store views under the same website. The main idea behind the code is to make magento share the cart for all store views not just the ones in the same website.
I'm not sure it will work for any websites configuration but you can take a shot.

0
votes

try this works definitely, but its better to overwrite model file.

thanks to this post. Single Cart multiple websites in Magento

I've made it different way and it works: I have single installation with multple domains and store and single SSL

I have main web site where i have all products from my other websites and it set with SSL. 1. Share customers account between multi-store: You can configure this feature here: System -> Configuration -> Customer Configuration -> Share Customer Accounts ->Global 2.Share the cart content between Magento multi-store websites:

Magento uses separate cart sessions for each store. To use one website on the checkout session you need to modify the Mage_Checkout_Model_Session class. Copy this file: app/code/core/Mage/Checkout/Model/Session.php to: app/code/local/Mage/Checkout/Model/Session.php.

After that add the following source code to the class:

class Mage_Checkout_Model_Session extends Mage_Core_Model_Session_Abstract
{
   const CHECKOUT_STORE_ID = 1;

   public function getCheckoutStoreId()
   {
      return self::CHECKOUT_STORE_ID;
   }

Change CHECKOUT_STORE_ID value 1 to your Magento store ID with all products and SSL.

Next, find all such elements in the file:

Mage::app()->getStore()

and change them to:

Mage::app()->getStore($this->getCheckoutStoreId())

And that is it!

Clear Magento cache and check your store. Now your Magento will use one cart for different multi-domain stores websites. There are 3 limitations of this solution:

  1. All prices in the cart will be from the store you selected (using CHECKOUT_STORE_ID). So if you have different prices for different stores it will not work in the cart.
  2. The currency in the cart will be the same as in the store you selected.
  3. The link for editing items in the cart will will not redirect customer to original cart website.