Hi, I'm trying to write a test function that will change the ucrrency on our site. I have a page that sets the currency from a dropdown, like so
SiteContext.Current.Currency = currencyCode;
WHen I do a refresh
and call SiteContext.Current.Currency.CurrencyCode;
It seems to default to the USA each time. My quesitons is SiteContext.Current.Currency meant ot persist longer than a single page request, or, should i be setting it on a per page basis. Having to manually set it on each request doesn't feel right ?
Which version are you using?
By default the SiteContext.Currency is persisted to cookie, so I guess you have some code to set it back the default value?
Some of our sample code will set the Currency to the DefaultCurrency of the market when you call SetCurrentMarket on IMarketService. Is this the case?
We're using 8.9.
I guessmy issue is that i'm setting and and it's not perssiting. On page refesh for an anonmous user it just reverts to USD each time.
You can create your own class inherited from SiteContext and override what Currency you want to return (based on current user, may be?) then register it in your InitializationModule for the SiteContext.