Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Nedergaard 37 posts 144 karma points
    Aug 22, 2012 @ 14:31
    Kim Nedergaard
    1

    Multilingual with multiple currencies

    Hi there,

    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 = DKK
    UK = £

    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?

  • Anders Burla 2560 posts 8256 karma points
    Aug 22, 2012 @ 16:24
    Anders Burla
    0

    Hi Kim

    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? :)

    Kind regards
    Anders

  • Kim Nedergaard 37 posts 144 karma points
    Aug 23, 2012 @ 12:36
    Kim Nedergaard
    0

    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 :)

  • Kim Nedergaard 37 posts 144 karma points
    Aug 27, 2012 @ 10:40
    Kim Nedergaard
    0

    Hi again

    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?

  • Anders Burla 2560 posts 8256 karma points
    Aug 27, 2012 @ 10:49
    Anders Burla
    0

    Hi Kim

    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 :)

    Kind regards
    Anders

  • Anders Burla 2560 posts 8256 karma points
    Sep 04, 2012 @ 13:21
    Anders Burla
    0

    Hi Kim

    Did you get this to function the way you want?

    Kind regards
    Anders

  • Allan Kirk 36 posts 110 karma points c-trib
    Jan 30, 2013 @ 03:16
    Allan Kirk
    0

    Hi Anders

    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:

    line 23

    <xsl:variable name="currentCurrency" select="teacommerce:GetCurrentCurrency()"/>

    line 68

    <xsl:variable name="price" select="teacommerce:FormatPriceWithSpecificCulture($priceUnFormatted, $currentCurrency/@cultureName)" />

  • Anders Burla 2560 posts 8256 karma points
    Jan 30, 2013 @ 08:00
    Anders Burla
    0

    Hi Allan

    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.

    Kind regards
    Anders

  • Allan Kirk 36 posts 110 karma points c-trib
    Jan 31, 2013 @ 08:18
    Allan Kirk
    0

    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?

  • Anders Burla 2560 posts 8256 karma points
    Jan 31, 2013 @ 08:25
    Anders Burla
    0

    There is no automatic way to do that. You will have to do some work your self :)

  • Tomasz Kowalski 135 posts 445 karma points
    May 24, 2017 @ 09:57
    Tomasz Kowalski
    0

    Hi Anders,

    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.

    Regards

    Tomasz

  • Anders Burla 2560 posts 8256 karma points
    May 24, 2017 @ 16:08
    Anders Burla
    0

    Hi Thomasz

    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.

    https://docs.teacommerce.net/v3.0.0/reference#setcurrentcurrency

    Kind regards

    Anders

  • Tomasz Kowalski 135 posts 445 karma points
    May 29, 2017 @ 07:49
    Tomasz Kowalski
    0

    Hi Anders,

    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 :)

    Kind regards Tomasz

  • Anders Burla 2560 posts 8256 karma points
    May 29, 2017 @ 07:57
    Anders Burla
    1

    Hi Tomasz

    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.

    Kind regards

    Anders

  • Tomasz Kowalski 135 posts 445 karma points
    May 29, 2017 @ 12:32
    Tomasz Kowalski
    0

    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!

    Kind regards

    Tomasz

  • Anders Burla 2560 posts 8256 karma points
    May 29, 2017 @ 13:21
    Anders Burla
    0

    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.

    Kind regards

    Anders

Please Sign in or register to post replies

Write your reply to:

Draft