I want to get the full URL to switch currency to use it as a link, Currency switcher use the widget to change the currency, I don't want to use the widget. For Example:

This is how works now:

<a href="#" data-post="{"action":"http:\/\/localhost\/directory\/currency\/switch\/","data":{"currency":"USD","uenc":"aHR0cDovL3Rlc3RzaG9wLmlvLz9fX19zdG9yZT1kZWZhdWx0Jl9fX2Zyb21fc3RvcmU9ZnI,"}}">Currency</a>

I want something like this:

<a href="http://localhost/directory/currency/switch/USD/uenc/aHR0cDovL3Rlc3RzaG9wLmlvLz9fX19zdG9yZT1kZWZhdWx0Jl9fX2Zyb21fc3RvcmU9ZnI">Currency</a>


NOTE: I'm overriding the directoy module, I already override the template, but can't get the full url


You have to just pass currency full url as like below in your template file:

You have forgotton to pass querystring currency before USD .


You have to keep above anchor tag to use in your file.

Above url action go to magento module-directory/Controller/Currency/Switch file.

You can check here function execute() getting post data currency as final currency switcher.

Here this file contains main logic for currency switcher.

You have to pass just currency three digit format to pass your main currency.

If you have to convert euro you have to set currency/EUR, if you want to convert British pound then pass currency/GBP in your above url after directory/currency/switch.

  • Thank you so much for your answer, I asked because I saw the parameter "uenc" whis is one kind of encoded parameter, don't know really well, but I was trying to figure out it how to get the full url with this encoded parameter, I don't want to change the original functionality. Aug 21 '16 at 9:48

The above code will redirect back to the homepage after changing currency. Just base_64 encode previous page url and attach after uenc/

This will now redirect back to the specified page on which you changed currency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.