Multi-store roadmap. Let's discuss (UPDATE: done)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
a.m. wrote:
How can it be set up on localhost?
It can be set up with Windows hosts file.

1. Add the following line to hosts file:
127.0.0.1       testhost1
127.0.0.1       testhost2

2. Run the site from Visual Studio and configure two stores in nopCommerce admin area. Set the HOST values of the first store to "testhost1:15536" and set it to "testhost2:15536" for the second store. Just replace port number with your one

3. Now open the following URLs in your browser: http://testhost1:15536/ and  http://testhost2:15536/



I followed the steps above to config the multiple stores in the Visual Studio.

The Urls http://testhost1/ and http://testhost2/ work well. But URLs http://testhost1:15536/ and  http://testhost2:15536/ don't work well.

The error message is :

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.

I am thinking if I need add the hostname in the IIS. Could anyone help me?


Many Thanks,
9 years ago
It can be set up with Windows hosts file.

1. Add the following line to hosts file:
127.0.0.1       testhost1
127.0.0.1       testhost2

2. Run the site from Visual Studio and configure two stores in nopCommerce admin area. Set the HOST values of the first store to "testhost1:15536" and set it to "testhost2:15536" for the second store. Just replace port number with your one

3. Now open the following URLs in your browser: http://testhost1:15536/ and  http://testhost2:15536/

------------------------------------------------------------------------------------
As you suggest above i did it in same manner but could not get expected result page still on default page that runs through Visual studio.
Let me explain further,
Actullay i want to use it for school project that have their own category and products on it.
6 years ago
Andrei,

There are issues with these directions and the latest directions in the nopCommerce documentation.
For instance:

According to our web-host, Liquidweb, you cannot setup a separate domain (store2) and forward the requests to store1 as Plesk requires a domain alias. That's fine... almost.

Setting up a domain alias works but the instructions should specify you MUST use a Multi-Domain SSL certificate. You cannot use a separate SSL certificate or wildcard certificate for store 2 because there is no way to generate a CSR for it because it is an alias in Plesk and therefore not part of IIS so a Multi-Store certificate must be used.

The issue is using emails for store2. It appears it cannot be done. In the alias you can enable mail service but I am told from web host that that will change all mail from store1 to the alias store2. It will not separate the emails between store1 and store2. Using an alias there is no way to even configure an email address for store2 in Plesk.  

So how can I send emails from store2 if I cannot create email accounts for store2 using the alias? You cannot create email accounts for an alias. If I cannot create email accounts for an alias I cannot create separate email templates that point to store2 email accounts.

Thanks,
Greg



a.m. wrote:
And here we go. Download the latest version here and give it a try. Almost everything is ready. Here are some things still to be done:
1. Product tags per store. We should display product tags only for the current store. UPDATE: DONE
2. Blog posts per store. UPDATE: DONE
3. Polls per store (maybe)
4. Reward points history per store (maybe)
5. Limit plugin per store (maybe)

How to set up multi-store. For example, we have two stores: www.store1.com and www.store2.com
Step 1. Upload and install the site on www.store1.com. This is only place where nopCommerce files and DLLs will be stored.
Step 2. Go to the control panel of "www.store2.com" (your hosting control panel, and not nopCommerce admin area) and ensure that all requests to "www.store2.com" are forwarded (not redirected) to "store1.com". Do it using CNAME records. This step is very important.
Step 3. Go to the control panel of "www.store1.com" and configure a domain alias for "store2.com". This step could be complex for some users. Just ask your administrator to do it if you experience any issues. Once it is done, when you open "www.store2.com" in your browser, you should see the content of "www.store1.com".

Find how this step 3 could be done in Plesk control panel below:
When "www.store2.com" is redirected to "www.store1.com", the web server for Plesk does not know how to display "www.store2.com" because it uses what's called Name-Based Virtual Hosting. The solution is simple, you just have to create a domain alias for "www.store2.com". For future reference, here is how you would do this:
3a. Log in to the domain panel for "www.store1.com", either directly or via the "Open in Control Panel" link in the server admin panel
3b. Go to the Websites & Domains tab and select the "Add New Domain Alias" link near the bottom
3c. Enter the full alias (in this case "store2.com")
3d. Make sure "Web service" is checked. "Mail service" is optional, this is if you want mail the @store2.com to redirect in a similar way. Leave "Synchronize DNS zone with the primary domain" unchecked.

Step 4. Go to admin area > configuration > stores and configure all your store(s). Enter a store name and URL for each store you have. And there is a new very important field "HOST values". The comma separated list of possible HTTP_POST values (for example, "store1.com,www.store1.com" for the first store and "store2.com,www.store2.com" for the second store). This property is required only when you have a multi-store solution to determine the current store. This field will allow us to distinguish requests to distinct URLs and determine the current store. You can also see the current HTTP_POST value on the "System information" page in admin area.

That's all. Now you have two stores "www.store1.com" and "www.store2.com" using a single nopCommerce installation.

Looking forward for your feedback

P.S. Multi-store solution (distinction of stores by HTTP HOST) won't work for sites in virtual categories on the same domain. For example, if you have one store on http://www.site.com/store1 and the second store on http://www.site.com/store2. It's impossible because HTTP HOST values for both of these sites is the same (www.site.com)
6 years ago
Hi dear Andre.
I add 2 follow lines to localhost :
127.0.0.1   testhost1
127.0.0.1   testhost2

and create 2 store in admin area with names:
testhost1:15536
testhost2:15536

But when i want to run this url : testhost1:15536
I encounter with this error:

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.


Thanks.
4 years ago
(version 4.20)
Please note that as well as adding the hosts, I found I needed to add matching entries in the ...\src\.vs\config\applicationhost.config file in the <site name="Nop.Web"> section, e.g.
<bindings>
                    <binding protocol="http" bindingInformation="*:15536:localhost" />
          <binding protocol="http" bindingInformation="*:15536:testhost1" />
          <binding protocol="http" bindingInformation="*:15536:testhost2" />
                </bindings>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.