Copied to clipboard

Flag this post as spam?

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


  • Zakhar 171 posts 397 karma points
    Jul 02, 2014 @ 18:27
    Zakhar
    0

    How to change currency?

    Hi!

    I've been trying to utilize Tea Commerce on my site, I installed the package and looking into the started kit and documentation.

    I need a way for users to be able to change currency, I didn't find it in the started kit and looking at the documentation, but it doesn't seem to be working.

    I'm displaying current currency on the page using Razor:

    @{
      Currency currentCurrency = TC.GetCurrentCurrency( storeId );
    }
    <p>@currentCurrency.Name @currentCurrency.Symbol</p>
    

    Then I try to change it using javascript:

    var currency = TC.getCurrency({storeId:1, currencyId:3}); 
    

    currency javascript variable seem to be set to the right currency, but after I refresh the page it's still default one.

    How ca I do it? Btw, is the method name correct?

    Thank you.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 02, 2014 @ 21:13
    Dennis Aaen
    1

    Hi Zakhar,

    I have only played a litlle bit with Tea Commerce starter kit some while ago. But maybe this can help you.

    http://rune.gronkjaer.dk/en-US/2011/07/15/tea-commerce-languages-countries-and-currencies/

    Have you tried to use the TC.SetCurrentCurrency, from the documentation it says: SetCurrentCurrency: Changes the current currency of the customer's session. The currency is also changed for the customer's current order if present.

    @using TeaCommerce.Umbraco.Web 
    @using TeaCommerce.Api.Models

    @{
        Currency currency = TC.SetCurrentCurrency(1, 2);
    }

    You can find the documentation for SetCurrentCurrency here: http://documentation.teacommerce.net/razor-api/currency/setcurrentcurrency/

    Hope this can help you.

    /Dennis

  • Anders Burla 2560 posts 8256 karma points
    Jul 03, 2014 @ 09:21
    Anders Burla
    0

    Hi Zakhar

    @Dennis is right - THANKS!

    Kind regards
    Anders

  • Zakhar 171 posts 397 karma points
    Jul 03, 2014 @ 10:46
    Zakhar
    0

    Hi guys,

    Thanks, I tried that too, but it doesn't work either.

    I currently have 2 currencies, GBP (id = 2) and USD (id = 3)

    I have this code on my page:

      Currency currency = TC.SetCurrentCurrency(storeId, 3);
      Currency currentCurrency = TC.GetCurrentCurrency( storeId );
    

    Both of these variables are GBP, and changing id in metod call doesn't change anything, if I try TC.SetCurrentCurrency(storeId, 42); it's still GBP, no errors or anything. I'm using Tea Commerce 2.3.1 with Umbraco 6.1.6

    Zakhar.

  • Anders Burla 2560 posts 8256 karma points
    Jul 03, 2014 @ 12:17
    Anders Burla
    101

    Is the currency allowed in the payment country that your order has at the moment (the default country is specified at the store settings). If the currency isnt allowed, it wont change.

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft