Results 1 to 3 of 3

Thread: Change Currency-Setting by URL?

  1. #1
    Join Date
    Jul 2008
    Posts
    64

    Question Change Currency-Setting by URL?

    Hi Folks,

    For changing the specified language, we use the parameter ""?localesetting=en-us" in the URL. Is there a similar way to change the currency? Or do we really have to use the pulldown-Menu?

    Thanks!

    Michael

  2. #2
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    432

    Default

    Do both at the same time using just the locale param...

    We implemented some SEO friendly urls for v8 and v9 that allow language specific product pages and category pages. For example:

    www.mysite.com/de/p-1234-productname.aspx (the product in German)
    www.mysite.com/us/p-1234-productname.aspx (the product in English)

    We do something similar to you by detecting the '/de/' in the URL and then converting this into a locale parameter for showproduct.aspx, for example:

    showproduct.aspx?productid=xyz&localeid=en-us

    To switch locale and currency at the same time, edit your SkinBase.cs file in the 'GetTemplateName()' method and create some lines of code similar to this (m_customlocale is the value of the locale parameter from the URL):

    Code:
    if (m_customlocale != "")
    {
    	ThisCustomer.LocaleSetting = m_customlocale;
            String CurrencySetting = AppLogic.GetLocaleDefaultCurrency(m_customlocale);
    	if (CurrencySetting.Length == 0)
    	{
    		CurrencySetting = Localization.GetPrimaryCurrency();
    	}
    	ThisCustomer.CurrencySetting = CurrencySetting;
    }
    This allows you to get the currency for the specific locale.

    Adam

  3. #3
    Join Date
    Jul 2008
    Posts
    64

    Default

    Thanks weboptius!

    I adapted your solution: I Just added

    String CurrencyQS = String.Empty;
    CurrencyQS = CommonLogic.QueryStringCanBeDangerousContent("Curr ency");
    if (CurrencyQS != "")
    {
    ThisCustomer.CurrencySetting = CurrencyQS;
    }

    to the skinbase and added two icons to my template (CHF and EUR) which link to "?Currency=CHF" or "?Currency=EUR".

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •