Page 1 of 1

changing currency preference in scriplet

Posted: Fri Dec 26, 2008 9:24 am
by Carolharry
Hi,

Ablecommerce is having feature for user to change currency of his preference.
I would like to change it programatically in scriplet.

I wrote #set ($User.Usercurrency.currencyid=2)(aus currency which i added) in the currency page scriplet.
But the product currency display doesn't change to australian dollar amount when I browse the products page.
Can scriptlets be used to do some programming or is it only HTML.
I tested a lot,and it looks like all the properties are ready only and cannot be set programatically.

Any one please help.

Thanks in advance
Carol

Re: changing currency preference in scriplet

Posted: Fri Dec 26, 2008 9:38 am
by mazhar
Scriptlets makes use of the NVelocity code. The code you have provided above wont effect at all. In order achieve this you need to write some ASP.NET server side code that carries out this job. For example you can create some ConLib control and then do this job in that control. You can then put that control in scriptlets to bring it in your pages.

For example you can create AUSCurrency.ascx file in ConLib with following contents for a sample

Code: Select all

<%@ Control Language="C#" ClassName="AUSCurrency" %>

<script runat="server">

    protected void ButtonAUSCurrency_Click(object sender, EventArgs e)
    {
        Token.Instance.User.UserCurrencyId = 2;
        Token.Instance.User.Save();
    }
</script>

<asp:Button ID="ButtonAUSCurrency" runat="server" OnClick="ButtonAUSCurrency_Click"
    Text="AUS" />
Also check the ConLib/UserCurrencyDropDown.ascx control for more information about how to get all store currencies and giving the user ability to select among them.

Re: changing currency preference in scriplet

Posted: Fri Dec 26, 2008 10:44 am
by Carolharry
Thank you for the reply.

Appreciate it.