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
I cant believe i havent read the col name i feel so small lol

Lack of sleep Zzz

By the way thank you so much man
10 years ago
Hi,
I'm trying to add an ACL like mechanism to a site running 3.00.
I want to control which user can Access which store in summary.
tried using current ACL mechanism to webstore context but as you would guess we got stuck on circular reference on IStoreContext.CurrentStore which we tried to call _workContext from
WebStoreContext.

don’t want to solve this externally in controllers, I rather solve it in the FrameWork project.

Is there any other method to go the CurrentCustomer in WebStoreContext?


thanks for help
10 years ago
I did the exact same thing what i did basically is implemented the IStoreMappingSupported interface at CustomerRole class

added the mapping field LimitedToStores and made the value 1

so now you can do the following

private List<Store> GetGrantedStores(ICollection<CustomerRole> collection)
        {
            List<Store> stores = new List<Store>();

            foreach (var cs in collection)
            {
                int[] storeIds = this._storeMappingService.GetStoresIdsWithAccess<CustomerRole>(cs);

                for (int i = 0; i < storeIds.Length; i++)
                {
                    var store = this._storeService.GetStoreById(storeIds[i]);

                    stores.Add(store);
                }
            }

            var query = (from s in stores select s).Distinct();

            return query.ToList();
        }

I also modified the Store module in the admin area to add ACL to Stores
10 years ago
mchehab wrote:
I did the exact same thing what i did basically is implemented the IStoreMappingSupported interface at CustomerRole class

added the mapping field LimitedToStores and made the value 1

so now you can do the following

private List<Store> GetGrantedStores(ICollection<CustomerRole> collection)
        {
            List<Store> stores = new List<Store>();

            foreach (var cs in collection)
            {
                int[] storeIds = this._storeMappingService.GetStoresIdsWithAccess<CustomerRole>(cs);

                for (int i = 0; i < storeIds.Length; i++)
                {
                    var store = this._storeService.GetStoreById(storeIds[i]);

                    stores.Add(store);
                }
            }

            var query = (from s in stores select s).Distinct();

            return query.ToList();
        }

I also modified the Store module in the admin area to add ACL to Stores


Where do you compare current customer roles and store ACL ( GetGrantedStores ) ?

In controllers or framework ?
10 years ago
senertunali wrote:

Where do you compare current customer roles and store ACL ( GetGrantedStores ) ?
In controllers or framework ?


Each customer has multiple customer roles you can get that using

this._workContext.CurrentCustomer.CustomerRoles in your controllers.
10 years ago
mchehab wrote:

Where do you compare current customer roles and store ACL ( GetGrantedStores ) ?
In controllers or framework ?

Each customer has multiple customer roles you can get that using

this._workContext.CurrentCustomer.CustomerRoles in your controllers.



Thanks for the help..
All I want is to access the currentcustomer or authenticatedcustomer in the web.framework(webstorecontext) but I can not because of circular reference or dependency etc.

I have already added store to acl but I can not use it due to the reason above.

Is there another way to access customer in the web.framework(webstorecontext) without putting code in each controller ?
Otherwise, I have to use the above mentioned method like you have said.
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)


Hi Andrei,

How we could setup SSL for a domain alias?

I did some google research. But there is no straight way.

See here (http://forum.parallels.com/showthread.php?291337-SSL-in-Domain-Alias-How) for a simlier question on Plesk forum.

We have 2 certificates for our 2 domains. now trying to setup as 2 stores in Nop Commerce.

Any steps or hacks or ideas on this?

Thanks.

Jey.
10 years ago
jeyara 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)

Hi Andrei,

How we could setup SSL for a domain alias?

I did some google research. But there is no straight way.

See here for a simlier question on Plesk forum.

We have 2 certificates for our 2 domains. now trying to setup as 2 stores in Nop Commerce.

Any steps or hacks or ideas on this?

Thanks.

Jey.


Hi Jey, I have been looking into this problem and I don't believe it is possible in IIS before version 8.0.

With 8.0 you can create different bindings for each domain with each domain having its own certificate. You have to use SNI, which means very old browsers (eg. IE6) won't work as they don't support SNI...but that is not a huge concern I think, especially as WinXP will begin its final death throws in 2014. Most browsers even on mobile platforms now support SNI.

More info here and a great walkthrough is here.

Not for the faint-hearted! Took me quite a while to get it working.

I would also advise (if you are on dedicated server) using Central Certificate Store to manage the SSL certs - so much easier once you understand it than the old way!
10 years ago
rmcsharry wrote:


Hi Jey, I have been looking into this problem and I don't believe it is possible in IIS before version 8.0.

With 8.0 you can create different bindings for each domain with each domain having its own certificate. You have to use SNI, which means very old browsers (eg. IE6) won't work as they don't support SNI...but that is not a huge concern I think, especially as WinXP will begin its final death throws in 2014. Most browsers even on mobile platforms now support SNI.

More info here and a great walkthrough is here.

Not for the faint-hearted! Took me quite a while to get it working.

I would also advise (if you are on dedicated server) using Central Certificate Store to manage the SSL certs - so much easier once you understand it than the old way!


Hi rmcsharry,

Thanks for your reply. Glad to know you found a workaround.

Yes, we are on VPS but Windows Server 2008. We paid for 2 domain certificates (we have 2 eStores) for 2 years. Now half way thorough our certificate life. Going for a central certificate also costs us.

Really appreciated Nop Commerce product for its features. But this SSL issue/point should be noted in the release notes as well. Stating about this SNI issue.

Your solution is appealing. So need to upgrade our VPS from Win 2008 to Win 2012 as well. We use pleask to manage our server(emails, ftp etc) so wonder how it can be achieve this without breaking Plesk.
10 years ago
jeyara wrote:


Hi Jey, I have been looking into this problem and I don't believe it is possible in IIS before version 8.0.

With 8.0 you can create different bindings for each domain with each domain having its own certificate. You have to use SNI, which means very old browsers (eg. IE6) won't work as they don't support SNI...but that is not a huge concern I think, especially as WinXP will begin its final death throws in 2014. Most browsers even on mobile platforms now support SNI.

More info here and a great walkthrough is here.

Not for the faint-hearted! Took me quite a while to get it working.

I would also advise (if you are on dedicated server) using Central Certificate Store to manage the SSL certs - so much easier once you understand it than the old way!

Hi rmcsharry,

Thanks for your reply. Glad to know you found a workaround.

Yes, we are on VPS but Windows Server 2008. We paid for 2 domain certificates (we have 2 eStores) for 2 years. Now half way thorough our certificate life. Going for a central certificate also costs us.

Really appreciated Nop Commerce product for its features. But this SSL issue/point should be noted in the release notes as well. Stating about this SNI issue.

Your solution is appealing. So need to upgrade our VPS from Win 2008 to Win 2012 as well. We use pleask to manage our server(emails, ftp etc) so wonder how it can be achieve this without breaking Plesk.


Hi Jey,

From all the research and testing I have done I do believe IIS 8.0 on Win2012 is the only way but I use Remote Desktop to manage my servers (dedicated) so I am not familiar with Plesk, sorry!

I agree that the multi-store release notes should point out this limitation: multi-store setups with multiple different top level domains requires SNI on II8.0/Win2012. I have sent a PM to Andrei to see if he agrees, referencing this thread.

Regards,
Richard
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.