November Happy Hour will be moved to Thursday December 5th.

Setting thecurrent currency

Vote:
 

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 ?

THanks,

Jon

#120666
Apr 22, 2015 11:46
Vote:
 

Hi,

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?

Regards.

/Q

#120672
Apr 22, 2015 12:12
Vote:
 

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.

I've had a look in my cookie but can't see aanythign immediacytly realted to it, we also have a sceanior where peoples accounts will be locked tothe currency so we can't use cookies, can we change it ?

We can't use markets for this project because of the way the client needs to sue regions.

Thanks,

Jon

#120729
Apr 23, 2015 14:35
Vote:
 

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.

I've had a look in my cookie but can't see aanythign immediacytly realted to it, we also have a sceanior where peoples accounts will be locked tothe currency so we can't use cookies, can we change it ?

We can't use markets for this project because of the way the client needs to sue regions.

Thanks,

Jon

#120730
Apr 23, 2015 14:35
Vote:
 

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.

Regards.

/Q

#120737
Apr 23, 2015 16:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.