skip to Main Content

I am trying to implement common login in multi website for group of sites.
Suppose we have one site which have multicurrency and each website have different payment,price and inventory.

Example : uae.abc.com, in.abc.com, uk.abc.com all website should belongs to abc.com group of websites should have common login, similar would be xyz.com website.

if we tried using customer scope as global than once user registered user can login to all sites be it in group or not, trying to fix using below code to access same group using customer scope as website.

I have overridden MagentoCustomerModelConfigShare

public function isWebsiteScope()
    {
        if(in_array($this->_storeManager->getStore()->getId(), [1,2,3,4])) {
            return 0;
        }

if(in_array($this->_storeManager->getStore()->getId(), [5,6,7,8])) {
            return 0;
        }

        return $this->_config->getValue(
            self::XML_PATH_CUSTOMER_ACCOUNT_SHARE,
            MagentoStoreModelScopeInterface::SCOPE_STORE
        ) == self::SHARE_WEBSITE;
    }

But login is not working, can any one help me on this.
Thanks in advance

2

Answers


  1. If you want to have single account for all multi-stores you have to do the following:

    1 Share customer accounts

    You can configure this feature here: System -> Configuration -> Customer Configuration -> Share Customer Accounts.

    1. Share sessions between Magento websites.

    There are 3 possible store configurations:

    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.

    After that your customers will be able to switch between multi-stores Magento websites without re-login. In other words, if customer will login in one Magento website, he will be able to see another multi-store Magento website using his first store account.

    Login or Signup to reply.
  2. I think that that would be prohibited by either browser Content Security Policy or website XSS prevention. You could try a Microsoft-based sign in system so you could have a user data retrieval from a third database that only allows data to be accessed by the accounts that add it. Then, you also would get all the benefits of Microsoft security.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search