Hi Matt,
I was trying to set currency based on the current culture. I tried TC.SetCurrentCurrency(store-ID, currency-ID) but the values are not changing as i can see TC.GetCurrentCurrency(store-ID) returns old currency.
Which are the occasions where its unable to update current currency?
How can i solve this?
-Arun
It might be worth looking in your cookies at the teacommerce_* cookie and seeing if the currentCurrencyId value is the on you expect. If that is the case, then the value is getting set, but maybe something it preventing the order being updated with the value.
Do you have any event handlers that might be resetting the orders currency back to something else?
Hi Matt,
I didn't see any event handler to reset the currency,
after i tried TC.SetCurrentCurrency(store-ID, currency-ID) on the very next step i check the current currency with TC.GetCurrentCurrency(2); and see the new value is not updated. also var currency = TC.getCurrency({storeId:2}); in javascript seems not working.
-Arun
Sorry, but did you check your cookie values to see if they are being updated? As this is where the "current currency" gets stores if you don't have a current order.
Hi Matt
The cookie value is not getting updated after switched the currency.
I can see a cookie named _teacommerce-2_ having the content currentCurrencyId as 2 which is not changing after switching
I cleared the cookie and reloaded and now i can see the correct currency.
I tried deleting Dollar which is getting as default currency, and cleared cookies and loaded the page again but still i can see dollar being rendered.., also it get listed in currency section in countries
You say your cookie name was “teacommerce-2”? If so this would suggest your store ID is 2, but in the code snippets you’ve shown, you are passing a store ID of 1. Could this be the issue?
Ok, just checked the code again and one thing that could prevent it from being set is if the currency isn't allowed in either the current orders payment country, or where there is no current order, in the sessions current payment country.
Could you check if you have an order, what it's payment country is, or if not, what the sessions default country is and then ensure that the currency you want to switch to is allowed in that given country.
This is controlled in the currencies admin screen on the "Available in these countries" tab.
Yes...feel like this error is due the improper handling of currency and countries
I have given all currencies in all countries, but dollar is being my current currency.!
Then I'm struggling to think what else to suggest.
As I say, the only thing that prevents a currency being set as current currency is if it's not allowed in the orders / current payment countries country.
Do you have a current order? If so, can you identify what payment country it is set to and tell me? If you don't, can you tell me what GetCurrencyPaymentCountry is telling you is the current country? Can you then show me a screenshot of that countries admin screen? And then for the currency you want to change to, can you show me a screenshot of it's admin screen, clearly showing it's allowed in that country? Can you then show me the EXACT code you are using to set the currency?
Hi Matt,
When i tried delete the currency which shown incorrectly and recreated the error gone sureprisingly. I didn't get what happened.!
Now it seems resolved
also this is how i set the currency,
sometimes have seen the cookie doesn't get updated.! Can i handle that manually?
-Arun
Unable to set Current Currency
Hi Matt,
I was trying to set currency based on the current culture.
I tried
TC.SetCurrentCurrency(store-ID, currency-ID)
but the values are not changing as i can seeTC.GetCurrentCurrency(store-ID)
returns old currency.Which are the occasions where its unable to update current currency? How can i solve this?
-Arun
Hey Arun,
It might be worth looking in your cookies at the
teacommerce_*
cookie and seeing if thecurrentCurrencyId
value is the on you expect. If that is the case, then the value is getting set, but maybe something it preventing the order being updated with the value.Do you have any event handlers that might be resetting the orders currency back to something else?
/Matt
Hi Matt,
I didn't see any event handler to reset the currency,
after i tried
TC.SetCurrentCurrency(store-ID, currency-ID)
on the very next step i check the current currency withTC.GetCurrentCurrency(2);
and see the new value is not updated. alsovar currency = TC.getCurrency({storeId:2});
in javascript seems not working.-Arun
Sorry, but did you check your cookie values to see if they are being updated? As this is where the "current currency" gets stores if you don't have a current order.
Hi Matt
The cookie value is not getting updated after switched the currency.
I can see a cookie named
_teacommerce-2_
having the contentcurrentCurrencyId
as 2 which is not changing after switchingI cleared the cookie and reloaded and now i can see the correct currency.
I tried deleting Dollar which is getting as default currency, and cleared cookies and loaded the page again but still i can see dollar being rendered.., also it get listed in currency section in countries
-Arun
Hmmm, this is pretty strange. What version of TC are you on? The latest?
We are using
Tea Commerce 3.4.0
and Tea Commerce Starter Kit 4.2.5
in Umbraco 7
You say your cookie name was “teacommerce-2”? If so this would suggest your store ID is 2, but in the code snippets you’ve shown, you are passing a store ID of 1. Could this be the issue?
No..I tried with 2 which is my store ID.
Sorry for the confusion i just took that code from the documentation.
Ok, just checked the code again and one thing that could prevent it from being set is if the currency isn't allowed in either the current orders payment country, or where there is no current order, in the sessions current payment country.
Could you check if you have an order, what it's payment country is, or if not, what the sessions default country is and then ensure that the currency you want to switch to is allowed in that given country.
This is controlled in the currencies admin screen on the "Available in these countries" tab.
/Matt
Yes...feel like this error is due the improper handling of currency and countries
I have given all currencies in all countries, but dollar is being my current currency.!
Then I'm struggling to think what else to suggest.
As I say, the only thing that prevents a currency being set as current currency is if it's not allowed in the orders / current payment countries country.
Do you have a current order? If so, can you identify what payment country it is set to and tell me? If you don't, can you tell me what GetCurrencyPaymentCountry is telling you is the current country? Can you then show me a screenshot of that countries admin screen? And then for the currency you want to change to, can you show me a screenshot of it's admin screen, clearly showing it's allowed in that country? Can you then show me the EXACT code you are using to set the currency?
/Matt
Hi Matt,
When i tried delete the currency which shown incorrectly and recreated the error gone sureprisingly. I didn't get what happened.!
Now it seems resolved
also this is how i set the currency,
sometimes have seen the cookie doesn't get updated.! Can i handle that manually?
-Arun
is working on a reply...