changing currency preference in scriplet

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

changing currency preference in scriplet

Post by Carolharry » Fri Dec 26, 2008 9:24 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: changing currency preference in scriplet

Post by mazhar » Fri Dec 26, 2008 9:38 am

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.

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: changing currency preference in scriplet

Post by Carolharry » Fri Dec 26, 2008 10:44 am

Thank you for the reply.

Appreciate it.

Post Reply