Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Change Currency-Setting by URL?

  1. #1
    MiBfinity is offline Member
    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
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    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
    MiBfinity is offline Member
    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