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.
10 years ago
a.m. wrote:
If you mean shipping methods from admin area > configuration > shipping > shiping methods, then you can use "Shipping by weight" shipping rate computation method. It allows to configure shipping methods/rates per store.


Thanks a lot Andrei.

It's everything I need.

Mauro
10 years ago
are there any solutions regarding:
4. Schedule tasks. We should allow a store owner to decide on which store(s) a certain schedule task should be run. For example, "Send emails" task should be run only on one of the stores, and "Keep alive" on each store.
?

we are receving email multiple times, most probably becasue the "Send emails" task is running for each of the stores...
10 years ago
Please read my previous post first.

What we decided to do for multiple stores having problems (f.e. email were sent multiple times) is to only have one TaskManager.Instance running for all the stores. In order to accomplish this we will save the TaskManager start time to the DB in the Settings table; and I created a TaskSettings class for this purpose:
using Nop.Core.Configuration;
using System;
namespace Nop.Core.Domain.Tasks
{
    public class TaskSettings : ISettings
    {
        public DateTime TaskManagerStartDate { get; set; }
    }
}

We further verify the Application state bag to see whether the TaskManager was started or not. Personally, I think this could be skipped, but this was the first approach and we kept it. Here is the code from Global.asax.cs Application_Start handler:
            var settingService = EngineContext.Current.Resolve<ISettingService>();
            var tms = settingService.GetSettingByKey<DateTime>("TaskSettings.TaskManagerStartDate", DateTime.MinValue);
            //start scheduled tasks
            if (databaseInstalled && (Application["TaskManagerStarted"] == null) && tms == DateTime.MinValue)
            {
                Application["TaskManagerStarted"] = 1;
                settingService.SaveSetting(new TaskSettings() { TaskManagerStartDate = DateTime.UtcNow });
                TaskManager.Instance.Initialize();
                TaskManager.Instance.Start();
            }
and the full code from Application_End:
            if (TaskManager.Instance != null) TaskManager.Instance.Stop();
            var settingService = EngineContext.Current.Resolve<ISettingService>();
            settingService.SaveSetting(new TaskSettings() { TaskManagerStartDate = DateTime.MinValue });

Please let me know what you think of this approach, I am open to debate/implement any other suggestions.

As a note: we initially tried to use the Application bag to store info about Task Manager status and put all stores on the same AppPool, but turns out that even so, they are all different application and use separate Application state bags.

I hope that starting from this we can get this functionality to work optimally.

As per the initial question from Andrei (a.m.): he suggested to have task selection possibility per store, but this cannot be achieved because when we are executing a task only a FakeContext is available, so we have no idea which store it is running under. I would also like to "hear" some opinions about this.

Thanks,
Tamas
10 years ago
Hi! With this solutionm, There is a way to keep the login information through site1 and site2?
10 years ago
How is Google Analytics setup with multi-store?

Can I only track one store?
10 years ago
MikeMCSD wrote:
How is Google Analytics setup with multi-store?

Can I only track one store?

No, you can have one per store.
10 years ago
found it. thanks
10 years ago
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)


Thanks for the steps. Detailed and Clear.

Just got one further question.

How do i configure SSL for www.store2.com. Assume i have an dedicated IP and SSL, what are the steps i need to follow?
10 years ago
When i try to debug using VS and setting up the multistores using the exact way that you provided I still get
this._storeContext.CurrentStore is the main store everytime. no matter what I change in the url

127.0.0.1     SecondStore
127.0.0.1    ThirdStore
127.0.0.1     MainStore


1  MainStore         http://MainStore:15536/  False  NULL  NULL  0
2  SecondStore     http://SecondStore:15536/  False  NULL  NULL  1
3  ThirdStore        ThirdStore:15536/          False  NULL  NULL  2

The break point always shows that EShop is the current store though am typing http://ThirdStore:15536/

and the web page's title is still MainStore
10 years ago
hello Mchehab, based on what you copied in your post I think that you have the store URL-s set, but all the "HOSTS" are NULL. Please set the "hosts" property and try again :)

good luck,
tdezso
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.