Using different language with different domain on Nop 2.1

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 yıl önce
Hi....everyone...

I want to host websites with different languages and different domain name using single database....


e.g
www.abc.com with English Language and
www.xyz.com with french language.....

It does not matter to publish one or multiple application... But database should be only one...

Thank You...
12 yıl önce
nopCommerce doesn't have multistore support
12 yıl önce
a.m. wrote:
nopCommerce doesn't have multistore support


can i use specific language id..???

basically i want to host two nop application with same database...???
one nop application with using English language id.... and second with french language id... using same database...???


where should i pass language id ....???

Thank you...
12 yıl önce
No. Multistore is not supported. Only one web application is allowed now
12 yıl önce
if it is the same store just different language, u can pass a language id and set the workingLanguage  to the id u have passed

take  a look at the following. it's a theme example, u can do the same for lan

https://www.nopcommerce.com/boards/t/11616/dynamically-change-theme-via-url-.aspx
12 yıl önce
a.m. wrote:
No. Multistore is not supported. Only one web application is allowed now


I've done it....with nop 2.10

Thanks for support....
12 yıl önce
Dharmik wrote:
No. Multistore is not supported. Only one web application is allowed now

I've done it....with nop 2.10

Thanks for support....

Hi Dharmik:
Can you share how did you do it?
12 yıl önce
eadameg wrote:
No. Multistore is not supported. Only one web application is allowed now

I've done it....with nop 2.10

Thanks for support....
Hi Dharmik:
Can you share how did you do it?


1)Create a New language  with same Language culture  Like English which is default

2)Export View string resources from English to your any directory and import it to new language.

3)Modify your Web.config of Nop.web
Line no:43

  <appSettings>
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="UseSSL" value="false" />
    <add key="SharedSSLUrl" value="" />
    <add key="NonSharedSSLUrl" value="" />
    <add key="RouteDebugger:Enabled" value="false" />
    <add key="GoogleMerchantID" value="" />
    <add key="GoogleMerchantKey" value="" />
    <add key="GoogleEnvironment" value="Sandbox" />
    <add key="GoogleAuthenticateCallback" value="True" />
    <add key="langId" value="3" /> <!--Add this key to pass a language id ....-->
  </appSettings>


Now see your new  language id from database in Language table and pass in web.config

4)just modify your Home controller  of Nop.web

using System;
using System.Linq;
using System.Web.Mvc;
using Nop.Core;
using Nop.Core.Domain;
using Nop.Core.Domain.Blogs;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Forums;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Messages;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Tax;
using Nop.Services.Catalog;
using Nop.Services.Customers;
using Nop.Services.Directory;
using Nop.Services.Forums;
using Nop.Services.Localization;
using Nop.Services.Messages;
using Nop.Services.Orders;
using Nop.Services.Security;
using Nop.Services.Seo;
using Nop.Services.Topics;
using Nop.Web.Extensions;
using Nop.Web.Framework.Controllers;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Themes;
using Nop.Web.Models.Common;
using System.Web.Configuration;




namespace Nop.Web.Controllers
{
    public class HomeController : BaseNopController
    {
        private readonly ILanguageService _languageService;
        private readonly ILocalizationService _localizationService;
        private readonly IWorkContext _workContext;
        private readonly ICustomerService _customerService;
        private readonly IPermissionService _permissionService;
        private readonly CustomerSettings _customerSettings;
        private readonly CommonSettings _commonSettings;
        private readonly LocalizationSettings _localizationSettings;

        public HomeController(
             ITopicService topicService,
            ILanguageService languageService,
             ILocalizationService localizationService,
            IWorkContext workContext,
            ICustomerService customerService,
            IPermissionService permissionService,
            CustomerSettings customerSettings,
            
            StoreInformationSettings storeInformationSettings,
            CommonSettings commonSettings,
            LocalizationSettings localizationSettings)
        {
            
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._customerService = customerService;
            this._permissionService = permissionService;
            this._customerSettings = customerSettings;
           this._commonSettings = commonSettings;
            this._localizationSettings = localizationSettings;
        }
        public ActionResult Index()
        {
            int lid = Convert.ToInt32(WebConfigurationManager.AppSettings["langid"]);
            var language = _languageService.GetLanguageById(lid);
            if (language != null && language.Published)
            {
                _workContext.WorkingLanguage = language;
            }


            if (_localizationSettings.SeoFriendlyUrlsForLanguagesEnabled)
            {
                string applicationPath = HttpContext.Request.ApplicationPath;
                if (HttpContext.Request.UrlReferrer != null)
                {
                    string redirectUrl = HttpContext.Request.UrlReferrer.PathAndQuery;
                    if (redirectUrl.IsLocalizedUrl(applicationPath, true))
                    {
                        //already localized URL
                        redirectUrl = redirectUrl.RemoveLocalizedPathFromRawUrl(applicationPath);
                    }
                    redirectUrl = redirectUrl.AddLocalizedPathToRawUrl(applicationPath, _workContext.WorkingLanguage);
                    return Redirect(redirectUrl);
                }
                else
                {
                    string redirectUrl = Url.Action("Index", "Home");
                    redirectUrl = redirectUrl.AddLocalizedPathToRawUrl(applicationPath, _workContext.WorkingLanguage);
                    return Redirect(redirectUrl);
                }
            }
            else
            {
                if (HttpContext.Request.UrlReferrer != null)
                {
                    //return Redirect(HttpContext.Request.UrlReferrer.PathAndQuery);
                }
                else
                {
                    //return RedirectToAction("Index", "Home");
                }
            }

            return View();
        }
    }
}
12 yıl önce
u set the    _workContext.WorkingLanguage = language,  but u do not save it.

u have to save the settings
12 yıl önce
hezyz wrote:
u set the    _workContext.WorkingLanguage = language,  but u do not save it.

u have to save the settings


Where do i save this settings..???
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.