Developer forum

Forum » Ecommerce - Standard features » Ecommerce.Common.Context.LanguageID & Currency follow website setting

Ecommerce.Common.Context.LanguageID & Currency follow website setting

Lars Larsen
Lars Larsen
Reply

Hi

How can we force Ecommerce.Common.Context.LanguageID to follow the language and currency set in Ecommerce Setting in website settings.

As we run two websites on the same domain we experience that users are stucked to the language & currency set on the first visited website. 

We are running DW v9.6.9


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

You can upgrade... The current version of Dw does that automatically . you have to explicitly set ?LanguageID=lang1 before it sticks.

When users click over to website no 2, you can append ?LanguageID=lang1 to the link - or in either in the master template or a pageloaded notifcation, take a look at pageview.area vs. common.context.language and see if you should switch language.

Votes for this answer: 1
 
Lars Larsen
Lars Larsen
Reply

Hi Nicolai

Upgrade is not an option for us right now. We went with this code:

using Dynamicweb.Frontend;
using Dynamicweb.Ecommerce;
using Dynamicweb.Ecommerce.Common;
using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Notifications;
namespace TWG_Tea_Site.Notifications
{
    [Subscribe(Standard.Page.Loaded)]
    public class PageLoaded: NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            Context.LanguageID = PageView.Current().Area.EcomLanguageId;
            Context.Currency = Services.Currencies.GetCurrency(PageView.Current().Area.EcomCurrencyId);
        }
    }
}

 

You must be logged in to post in the forum