Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
We been working on a website using the teacommerce-project.But while devolping the website, we ran into a little problem which we can't figure out - how to solve.
The website is have several languages, DE, UK and DK. and we wish to use different currencies for each country.
DE = €DK = DKKUK = £We've set up the countries in the Teacommerce tab, we've set up the currencies, we've connected currencies and countries and we've set up the cultures on the pages.
So if we visit the DK-part of the site, it show the danish dictionary items and if we visit the DE-part of the site, it shows the german dictionary items. But the teacommerce:GetCurrentCountry() -extension keep returning the country that we selected as "Default".
So how do I get the teacommerce:GetCurrentCountry() to return the country that matches the culture that the page im visiting is using, instead of it allways returning the default?
The setup sounds like its done the right way. The default country is independent of the hostname/culture and that is why the default country is always returned. The right way to implement this is to hook into the WebshopEvents.OrderCreated. Here you check which node/url is active at the moment and depending on that you set the order.CountryId and save the order. This will set the initial country for the order and then if you still want the customer to be able to change the country in the cart flow he can do that.
Makes sense? :)
Hi Anders, thank you for your reply.Makes perfect sense.
I thought there where some sort of connection between the country and and hostname/culture.
But we'll try walking down the path that you described :)
We've been working on the solution that you mentioned with WebshopEvents.OrderCreated.
Our purpose is that a new visitor who is looking at the product list, before he put any products in the basket - will be presented with the correct currency.
Are there allways an order? so it's possible to call WebshopEvents.OrderCreated, even if the basket is empty?
A basket is created when ever you use it or interact with it. So if you need your setup you will have to create an order for each visitor ( because its created the first time you need info from the order - in this case a country which you need to set at the order to get the correct currency). Another option is to implement your own Session variable for the current country and use that for presenting the prices. I can send you the code for our "GetPrices" method in the xslt library. So we could try and get your case to work properly :)
Did you get this to function the way you want?
We are having the same problem as above, but unfortunatly I do not understand what you mean by "hook into the WebshopEvents.OrderCreated". As far as I can tell, we only have access to the XSLT files, surely there must be some way to make this work using just that?
Here is where I think the problem is, but I might be wrong:
<xsl:variable name="currentCurrency" select="teacommerce:GetCurrentCurrency()"/>
<xsl:variable name="price" select="teacommerce:FormatPriceWithSpecificCulture($priceUnFormatted, $currentCurrency/@cultureName)" />
You are right that you can send a specific culture name to the FormatPrice method to format the price using a specific method. So you can just change here to another one.
Okay, but that still changs it to a specific currency. Like the OP I would like to use the currency of the culture of the page. Isn't there an automatic way to do that?
There is no automatic way to do that. You will have to do some work your self :)
Almost 5 years later this solution does not work for me.
Umbraco 7.5.13, TC 3.2.2, 2 languages in Content and in TC Setting, 2 currencies.
GetPrice returns always default culture price.
I tried to hooked into OrderCreated event, but there is not such property as Order.CountrId. I've found Order.LanguageID, but it is always null and there is no difference if I set it to something else.
Any help will be appreciated.
What is your case? Try give as much info as possible. The price returned is using the default country (store setting) and the default currency of that country. If you want to switch currency when the user switch country then either you need to only have one currency available in the country and TC will automatically switch. If the currency is still available in the new country then you as a developer need to make the switch.
Thank you for quick response.
I think I have same case as Kim (first post): two (so far) nodes in Content with different domains and different languages (da-DK and de-DE in my case).
In TC Settings I have two Countries (Danmark and Germany) and two Currencies (DKK and Euro). I will have one Currency per Country. DKK has CultureName set to da-DK, Euro to de-DE. I'm not sure what about Region Code in Country. Do it need to be the same as CultureName?
All I wish is that when I open danish site, currency is set to DKK, and when I open german site, currency is set to Euro. I won't have any currency picker...
Rememeber, at I have to different domains per language (more to come).
I hope this is more understandable now :)
Tea Commerce does not handle that for you. You will have to set the correct currency based on the URL that is loaded and then somewhere in your master template set the currency on page load or something like that.
I've tried changing Currency "on-page-load" before, but it didn't work.
Now I tried changing payment country (TC.SetCurrentPaymentCountry) instead and now it works as supposed!
Thank you for help!
Ahh that is because the currency was only available in one country each of them and in that case you need to change the country instead and the currency will change automatically.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted