3

I have a requirement like this:

"Single backend admin site. Front end shows a main eCommerce website from which another website should open based on Product Category selection. I mean there will be one site. If one user selects a Product Category named "Men" then the user should go to another website called "menshopping.com" or some other domain name."

At present i have created two websites in magento 2.1.3 admin panel. One website url is called "womenshops.local". This is the main website. so admin url will become "womenshops.local/admin_test". Then i have created another website with url "menshops.local" having separate store and store view.

I am able to load these two domains separately. womenshops.local has a root category of "women" and menshops.local has a root category of "men". Therefore each websites shows different top level menu.

Now my issue is I don't know how to connect these two websites together and share customer and cart details between these websites. I had searched so many blogs and tried some solutions. But nothing worked.

My Magento root .htaccess file change:

SetEnvIf Host .*womenshops.local.* MAGE_RUN_CODE=base
SetEnvIf Host .*womenshops.local.* MAGE_RUN_TYPE=website
SetEnvIf Host .*menshops.local.* MAGE_RUN_CODE=men_site
SetEnvIf Host .*menshops.local.* MAGE_RUN_TYPE=website

I hope someone can point me in the right direction with this issue.

3
  • Have you try it with enable "Share Customer Accounts" from admin. Jan 24, 2017 at 9:14
  • @SHPatel: Yes. From my current Implementation as i described above ( usage of two websites womeshops.local and menshops.local) I tried enabling Share Customer Accounts to Global and Persistant Cookie domain to " .local ". This didn't worked. If i'm logged in womenshops.local and loads menshops.local in a new tab i need to login again.
    – Zammuuz
    Jan 24, 2017 at 9:19
  • Sharing a cart across different website is not available in magento2, but yes this can achieved by some tweaking in code. Another way of achieving this is, create 2 seperate stores "men" and "Women" with their own domains "men.local", women.local". Now cart can be shared across stores. Just set customer to global, set cookie setting the path to "/". This has been tested and working for me. JFI, cart can be shared for logged in customers only. May 2, 2018 at 9:48

2 Answers 2

1

To me, you should not use two different websites but two different stores instead.

Quoting this SO answer: https://stackoverflow.com/a/16953750/1038727

Website:

  • Possible to maintain a separate customer base for the website, or can share the customer accounts with all websites
  • Difference base currency can be defined
  • Different order base can be maintained (Need citation on this one)
  • Different prices can be given for the website using a configuration setting or can share the price globally
  • Different Website URLs can be used or can share the same website URL (Magento keeps unique cookies)

Store:

  • Customer accounts are shared among all the stores under a specific website
  • Same base currency
  • Same Price
  • Product can be assigned store specifically
  • Can have different root category configuration

Store View:

  • Common practice is to distinguish between different language views for store
  • Different display prices
  • Category settings can be different
  • Same root category for all store views

Inventory is global across all the websites and stores.

In your case I'm pretty use using two different stores under the same website will save your time and match your requirements ;)

6
  • So i need to create women_store and women_storeview & men_store and menu_storeview under "main website". Then in the web config for men_storeview the url i need to give as "menshops.local" . Correct???
    – Zammuuz
    Jan 24, 2017 at 9:30
  • @Ammu yes that's correct ;) Jan 24, 2017 at 9:31
  • Okay so if this is correct i have one doubt.. how should i navigate to menshops.local from womenshops.local ?? I need the user should be automatically navigated to menshops.local whenever the user selects a product under men category or sub category of men.
    – Zammuuz
    Jan 24, 2017 at 9:32
  • @Ammu well you need to assign your men products to your mens store and your womens products to your womens store. Jan 24, 2017 at 9:40
  • Okay so I need to create two root categories. One is women for the womenshops.local store and another is men for the menshops.local store. Okay let me try this.
    – Zammuuz
    Jan 24, 2017 at 9:44
1

I think you just have to add a static block in both website with another website link.

Like you have to create a static block for men website and put a link of women website their.

If you want to share the customer between these website, you can. Its in default magento setting.

6
  • Not only customer i also want to share the cart also.. so that there will be only a single checkout from both websites. is it possible?
    – Zammuuz
    Jan 25, 2017 at 2:43
  • @Ammu In that case you have to create multiple storeview in a single store and website. Set different url for different storeview. In this case you will get all things same in both url and you can set different theme for each. You can also set different static block as per my answer. Jan 25, 2017 at 6:19
  • One doubt.. Multiple storeviews will only create links to switch in the header section right?? As described in this link bsscommerce.com/blog/…
    – Zammuuz
    Jan 25, 2017 at 6:30
  • @Ammu. its default feature. But you can set stores on different urls same as you are setting website. Jan 25, 2017 at 7:01
  • I am totally confused... :( My requirement is to have two different stores having different product catalogs, which shares same customer login and cart info. for this should i follow 2 websites with respective stores or 1 website with 2 stores & views or 1 website with 1 store 2 views.
    – Zammuuz
    Jan 25, 2017 at 7:51

Your Answer

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

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