popahollic Posted December 31, 2010 Share Posted December 31, 2010 i have 2 currency, dollar & rupiah .. i want input the price in the admin (BO) with dollar ,, and appears in the website (FO) with Rupiah .. of course, after automatically converted ..anyone can tell me the way to do that .. ?? *thanks before for the answer .. Link to comment Share on other sites More sharing options...
rocky Posted December 31, 2010 Share Posted December 31, 2010 You can set the default currency on the Payment > Currencies tab to "Dollar", then enter the currency rate of "Dollar" to 1 and the currency rate of "Rupiah" to the appropriate multipler. You can then enter the prices in the Back Office in "Dollar" and customers will be able to see the prices in either "Dollar" or "Rupiah" on your website. Link to comment Share on other sites More sharing options...
popahollic Posted January 3, 2011 Author Share Posted January 3, 2011 You can set the default currency on the Payment > Currencies tab to "Dollar", then enter the currency rate of "Dollar" to 1 and the currency rate of "Rupiah" to the appropriate multipler. You can then enter the prices in the Back Office in "Dollar" and customers will be able to see the prices in either "Dollar" or "Rupiah" on your website. i don't want to use 2 option of currency in Front Office ($ | Rp)("Dollar" or "Rupiah") .. but , i want to automattically only use Rupiah in front office .. Link to comment Share on other sites More sharing options...
rocky Posted January 3, 2011 Share Posted January 3, 2011 Then uninstall the "Currency block" and change line 22 of init.php from: $cookie = new Cookie('ps'); $cookie = new Cookie('ps'); $cookie->id_currency = 2; Change 2 to the ID of the currency you want to be used in the Front Office. This will force the currency to 2 whenever a customer visits your site. Link to comment Share on other sites More sharing options...
popahollic Posted January 3, 2011 Author Share Posted January 3, 2011 Then uninstall the "Currency block" and change line 22 of init.php from: $cookie = new Cookie('ps'); $cookie = new Cookie('ps'); $cookie->id_currency = 2; Change 2 to the ID of the currency you want to be used in the Front Office. This will force the currency to 2 whenever a customer visits your site. IT WORKS .... THANK YOU VERY MUCH ..... Link to comment Share on other sites More sharing options...
jcs666a Posted April 11, 2011 Share Posted April 11, 2011 Hi there, the solution works perfectly for previous versions, but in the new 1.4 doesn't, I was trying to solve that, so I have a temporal solution, (at least while some one else get a better solution)In your headet.tpl file from your template directory add this in the line 63 or wherever your body tag is: <body {if $page_name}onLoad="setCurrency(1);" id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}> I just added the command that call the function to change the currency when loads the page "setCurrency();", you have to change the value for your prefered currency value Link to comment Share on other sites More sharing options...
DAB it Posted June 17, 2011 Share Posted June 17, 2011 Hello,Doesn`t works in Prestashop 1.4. I put that code in header.tpl but is no change in front office. Link to comment Share on other sites More sharing options...
bellini13 Posted June 18, 2011 Share Posted June 18, 2011 for v1.4 you can override the Tools class using the following code.This code forces the Front Office currency to ZAR (or Rand), while leaving the Back Office currency whatever the default currency is. class Tools extends ToolsCore { public static function setCurrency() { global $cookie; $currency = Currency::getCurrencyInstance((int)Currency::getIdByIsoCode('ZAR')); if (is_object($currency) AND $currency->id) $cookie->id_currency = (int)($currency->id); return $currency; } } Link to comment Share on other sites More sharing options...
Mobelti Posted June 25, 2011 Share Posted June 25, 2011 i have 2 currency, dollar & rupiah .. i want input the price in the admin (BO) with dollar ,, and appears in the website (FO) with Rupiah .. of course, after automatically converted ..anyone can tell me the way to do that .. ?? *thanks before for the answer .. i hope , this module could be useful for youhttp://prestashopmodul.com/en/11-multi-currency-solution.html 1 Link to comment Share on other sites More sharing options...
titooooom Posted August 5, 2011 Share Posted August 5, 2011 Thanks for your help Y arriba Mexico!!! Hi there, the solution works perfectly for previous versions, but in the new 1.4 doesn't, I was trying to solve that, so I have a temporal solution, (at least while some one else get a better solution)<br/><br/>In your headet.tpl file from your template directory add this in the line 63 or wherever your body tag is:<br/> <body {if $page_name}onLoad="setCurrency(1);" id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}> <br/>I just added the command that call the function to change the currency when loads the page "setCurrency();", you have to change the value for your prefered currency value Link to comment Share on other sites More sharing options...
HandCraft Posted February 29, 2012 Share Posted February 29, 2012 Anyone has purchased this one? Does it work properly? i hope , this module could be useful for you http://prestashopmodul.com/en/11-multi-currency-solution.html Link to comment Share on other sites More sharing options...
ugur onur Posted May 8, 2012 Share Posted May 8, 2012 Anyone has purchased this one? Does it work properly? I am using for my clients web store. working perfect... Link to comment Share on other sites More sharing options...
doubleD Posted November 17, 2012 Share Posted November 17, 2012 (edited) for v1.4 you can override the Tools class using the following code. This code forces the Front Office currency to ZAR (or Rand), while leaving the Back Office currency whatever the default currency is. class Tools extends ToolsCore { public static function setCurrency() { global $cookie; $currency = Currency::getCurrencyInstance((int)Currency::getIdByIsoCode('ZAR')); if (is_object($currency) AND $currency->id) $cookie->id_currency = (int)($currency->id); return $currency; } } Hello, Works for Prestashop 1.5 Thank you! public static function setCurrency($cookie) { $currency = Currency::getCurrencyInstance((int)Currency::getIdByIsoCode('UAH')); if (is_object($currency) && $currency->id) $cookie->id_currency = (int)$currency->id; return $currency; } Edited November 17, 2012 by doubleD (see edit history) Link to comment Share on other sites More sharing options...
doubleD Posted November 17, 2012 Share Posted November 17, 2012 Anyone tried to do the same for 1.5 mobile theme? Any suggestions? Thank's Link to comment Share on other sites More sharing options...
curtisblackwell Posted August 28, 2013 Share Posted August 28, 2013 The problem with this solution is that it prevents users from being able to switch currencies. I need to have a separate default in front and back while maintaining the ability to change on the front. for v1.4 you can override the Tools class using the following code. This code forces the Front Office currency to ZAR (or Rand), while leaving the Back Office currency whatever the default currency is. class Tools extends ToolsCore { public static function setCurrency() { global $cookie; $currency = Currency::getCurrencyInstance((int)Currency::getIdByIsoCode('ZAR')); if (is_object($currency) AND $currency->id) $cookie->id_currency = (int)($currency->id); return $currency; } } Link to comment Share on other sites More sharing options...
curtisblackwell Posted August 28, 2013 Share Posted August 28, 2013 My solution: //////////////////////////////////////////////////////////////////////////////////////////////// // Override to show USD by default on front-end while maintaining KRW default in the back-end // //////////////////////////////////////////////////////////////////////////////////////////////// /** * Set cookie currency from POST or default currency * * @return Currency object */ public static function setCurrency($cookie) { if (Tools::isSubmit('SubmitCurrency')) if (isset($_POST['id_currency']) && is_numeric($_POST['id_currency'])) { $currency = Currency::getCurrencyInstance($_POST['id_currency']); if (is_object($currency) && $currency->id && !$currency->deleted && $currency->isAssociatedToShop()) $cookie->id_currency = (int)$currency->id; } if ((int)$cookie->id_currency) { $currency = Currency::getCurrencyInstance((int)$cookie->id_currency); if (is_object($currency) && (int)$currency->id && (int)$currency->deleted != 1 && $currency->active) if ($currency->isAssociatedToShop()) return $currency; else { // get currency from context $currency = Shop::getEntityIds('currency', Context::getContext()->shop->id); $cookie->id_currency = $currency[0]['id_currency']; return Currency::getCurrencyInstance((int)$cookie->id_currency); } } $currency = Currency::getCurrencyInstance(2); if (is_object($currency) && $currency->id) $cookie->id_currency = (int)$currency->id; return $currency; } Link to comment Share on other sites More sharing options...
betinhocarpi Posted October 8, 2013 Share Posted October 8, 2013 Then uninstall the "Currency block" and change line 22 of init.php from: $cookie = new Cookie('ps'); $cookie = new Cookie('ps');$cookie->id_currency = 2; Change 2 to the ID of the currency you want to be used in the Front Office. This will force the currency to 2 whenever a customer visits your site. hi Rocky, what I need to do to make prestashop 1.5.4.1 work ? thanks my friend. Link to comment Share on other sites More sharing options...
vekia Posted October 8, 2013 Share Posted October 8, 2013 prestashop 1.5 doesnt use $cookie variable, in new ps you have to use context object to achieve this Link to comment Share on other sites More sharing options...
betinhocarpi Posted October 9, 2013 Share Posted October 9, 2013 prestashop 1.5 doesnt use $cookie variable, in new ps you have to use context object to achieve this hi Vekia... Is this correct line ? if yes, how I change ? $context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));$context->id_currency = 2; like this not work... if this line is wrong, what is correct line ? thanks my friend. Link to comment Share on other sites More sharing options...
vekia Posted October 9, 2013 Share Posted October 9, 2013 you have to define whole new object, instead of : $context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));$context->id_currency = 2; just use: $context->currency = new Currency(2); 1 Link to comment Share on other sites More sharing options...
moy2010 Posted October 20, 2013 Share Posted October 20, 2013 These modifications have to be made in tools.php or in currency.php? Link to comment Share on other sites More sharing options...
vekia Posted October 21, 2013 Share Posted October 21, 2013 what ps version you use? everything depends on it Link to comment Share on other sites More sharing options...
gabortiz Posted November 19, 2013 Share Posted November 19, 2013 PrestaShop Legend how to solve it in PS 1.56 ? thanks Link to comment Share on other sites More sharing options...
Rares Irimia Posted December 3, 2013 Share Posted December 3, 2013 I have the same problem but in 1.5.6.1. How I can solve. Thanks. Link to comment Share on other sites More sharing options...
vekia Posted December 4, 2013 Share Posted December 4, 2013 you can use many currencies in prestashop, you can define default shop currency in back office: localization > localization there is option to define default currency. for what purposes you want different currencies? it's not useful Link to comment Share on other sites More sharing options...
grobiou Posted December 13, 2013 Share Posted December 13, 2013 Hello, I have the 1.5.6.1 and need the currecy number 2 in the frontoffice without allowing to change it and at the same time keep USD as default currency. What't the file name where I have to make the changes? Best regards. 1 Link to comment Share on other sites More sharing options...
grobiou Posted December 14, 2013 Share Posted December 14, 2013 Hello, I found a way around to solve my problem. As I don't need people to access my store from other countries, I turned on the geolocation feature and blocked everyone but my country. Also, turned off the Block Currency. This way, I have the USD as the default currency but in the frontpage is always displayed my country's currency. Link to comment Share on other sites More sharing options...
Margis Posted May 12, 2014 Share Posted May 12, 2014 Hello, How can I use this default currency override in multistore? Two shops have the same default currency in BO. I need one shop to show default currency in front office and another to show non-default currency on front office, so that user does not have to change it manually. Is it possible? PrestaShop version 1.5.6.2 you have to define whole new object, instead of : $context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));$context->id_currency = 2; just use: $context->currency = new Currency(2); Link to comment Share on other sites More sharing options...
christ67 Posted July 21, 2014 Share Posted July 21, 2014 Hello.... i just install Prestashop 1.5.6.2 for my web store. i want to use US Dollar as default currency in Back Office and Rupiah as default currency in Front Office (only one currency). My products is imported, so have to use US Dollar. Anybody can help me, please.... Best regards 1 Link to comment Share on other sites More sharing options...
bellini13 Posted July 21, 2014 Share Posted July 21, 2014 could you clarify how the product is imported? why not convert the price from USD to Rupiah prior to the import? Link to comment Share on other sites More sharing options...
genkiz Posted September 16, 2014 Share Posted September 16, 2014 (edited) Hi, How to solve this in 1.6.x? Where should I use $context->currency = new Currency(2); ? Thanks g Edited October 30, 2014 by genkiz (see edit history) 1 Link to comment Share on other sites More sharing options...
igalfsg Posted December 29, 2014 Share Posted December 29, 2014 genkiz did you find a way to fix it for 1.6.x? 1 Link to comment Share on other sites More sharing options...
cristidam Posted February 10, 2015 Share Posted February 10, 2015 (edited) Hi, For Prestashop 1.6.0.9 force currency in frontend. /public_html/classes/tools.phpReplace line 431$currency = Currency::getCurrencyInstance((int)$cookie->id_currency);with$currency = Currency::getCurrencyInstance((int)$cookie->id_currency=2);Replace line 433$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));with$currency = Currency::getCurrencyInstance(Configuration::get('id_currency')); It works on my website. Edited February 10, 2015 by cristidam (see edit history) 4 Link to comment Share on other sites More sharing options...
mmsh Posted July 15, 2015 Share Posted July 15, 2015 class Tools extends ToolsCore { public static function setCurrency() { global $cookie; $currency = Currency::getCurrencyInstance((int)Currency::getIdByIsoCode('GBP')); if (is_object($currency) AND $currency->id) $cookie->id_currency = (int)($currency->id); return $currency; } } eg. for GBP.. in PS1.4 but my question is: how to exclude payment modules? does it work for home, product pages, categories or that override works for any page? I need to exclude the payment module, if it has to show another currency with the correct exchange.. thanks Link to comment Share on other sites More sharing options...
mmsh Posted August 17, 2015 Share Posted August 17, 2015 (edited) hello, the real problem is another: if the default shop currency is GBP but the front currency for payment method is EUR the final invoice with this override method is GBP and it's not good...it should be EUR so I need to show GBP as default FRONT currency BUT in case the user chooses a payment method which allows EUR only after the final callback from the gateway the invoice must be in EUR... and THEN just the front currency has to return in GBP please, how to do it? Bellini, "...while leaving the Back Office currency whatever the default currency is." do you mean that in my case I should leave EUR as default shop currency and use the override for the front part only? Edited August 17, 2015 by mmsh (see edit history) Link to comment Share on other sites More sharing options...
lucasdemenezes Posted August 20, 2015 Share Posted August 20, 2015 Hi, For Prestashop 1.6.0.9 force currency in frontend. /public_html/classes/tools.phpReplace line 431$currency = Currency::getCurrencyInstance((int)$cookie->id_currency);with$currency = Currency::getCurrencyInstance((int)$cookie->id_currency=2);Replace line 433$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));with$currency = Currency::getCurrencyInstance(Configuration::get('id_currency')); It works on my website. this not work, because when i try to do it, cart is empty and i dont get checkout. beyond it, we get this error: Use of undefined constant PS_ROUND_HALF_DOWN - assumed 'PS_ROUND_HALF_DOWN' how to solve all this? Link to comment Share on other sites More sharing options...
dvir Posted September 27, 2015 Share Posted September 27, 2015 Then uninstall the "Currency block" and change line 22 of init.php from: $cookie = new Cookie('ps'); $cookie = new Cookie('ps');$cookie->id_currency = 2; Change 2 to the ID of the currency you want to be used in the Front Office. This will force the currency to 2 whenever a customer visits your site. hi , does it work on 1.6.0.14 ? and what is the path of the file thank you Link to comment Share on other sites More sharing options...
kenkomuri Posted January 9, 2016 Share Posted January 9, 2016 Im using the latest version of Prestashop 1.6.1.4 and I am using USD as default currency in the backend (Importe products with cost in USD) of the store but I would like to use MXN (mexican peso) in the front end. Also I would like that PayPal module takes the MXN as input but in the website where is displayed the amount of the order is changed to USD taking into account the currency rate of Prestashop NOT PayPal. Link to comment Share on other sites More sharing options...
bakh Posted March 6, 2016 Share Posted March 6, 2016 I have been scratching my head whole day but cannot find the reason for this issue. My site is ginbaba.com I am having a similar problem, it is not possible to change the currency on the front office. I tried to make a new installation of prestashop 1.6.x and change the currency but that did not worked either. I hope someone can help. I have cleaned all the cashes ...... kindly help anyone ..... Link to comment Share on other sites More sharing options...
cosmoll Posted May 7, 2017 Share Posted May 7, 2017 You can buy an extension for PrestaShop or you can do it yourself, fix just two lines of code. So, open the file /classes/tools.php and find this (twice): Currency::getCurrencyInstance((int)$cookie->id_currency); And replace it to Currency::getCurrencyInstance(N); where N is an id of currency (1, 2, 3 etc.). That's all. Don't forget to save the file. Tested with PrestaShop 1.6. Link to comment Share on other sites More sharing options...
VickyG Posted May 25, 2017 Share Posted May 25, 2017 You can buy an extension for PrestaShop or you can do it yourself, fix just two lines of code. So, open the file /classes/tools.php and find this (twice): Currency::getCurrencyInstance((int)$cookie->id_currency); And replace it to Currency::getCurrencyInstance(N); where N is an id of currency (1, 2, 3 etc.). That's all. Don't forget to save the file. Tested with PrestaShop 1.6. Hi you copied this solution from another page on the web.... that's ok, but i was looking for some explanations more, the text is not clear for whom that are not developers :-) Can you please tell me what it means? N is an id of currency (1, 2, 3 etc.). Can you make an example? So, in my backoffice i pay EUR to my suppliers and i calculate the selling price in EUR. To do this, if i don't misunderstand, i set up the default currency to EUR. But I want my frontoffice to show another currency, for example USD, because my buyers will pay USD to me. So how should i change that line? Thank you very much for your help :-) V Link to comment Share on other sites More sharing options...
ibnuzahari Posted November 18, 2018 Share Posted November 18, 2018 Hello, Is there any solution for this for Prestashop 1.7.4.4? I want to set default currency on back office in Euro but Malaysian RInggit (MYR) for front office? And of course the MYR currency displayed after converted from Euro to MYR. Anyone can assist me on this, please? Thank You Link to comment Share on other sites More sharing options...
El Patron Posted November 18, 2018 Share Posted November 18, 2018 This module support different default front office currency than what is defined as your shop default currency. https://www.prestaheroes.com/en-us/modules/front-office-default-currency 1 Link to comment Share on other sites More sharing options...
Donny Posted October 2, 2019 Share Posted October 2, 2019 Thank you for the tip EL Patron! I bought that module 2 days ago after i saw this post and it works like a dream! Very reasonable price to. 1 Link to comment Share on other sites More sharing options...
El Patron Posted October 2, 2019 Share Posted October 2, 2019 On 11/18/2018 at 5:55 AM, El Patron said: This module support different default front office currency than what is defined as your shop default currency. https://www.prestaheroes.com/en-us/modules/front-office-default-currency 7 hours ago, Donny said: Thank you for the tip EL Patron! I bought that module 2 days ago after i saw this post and it works like a dream! Very reasonable price to. Thanks for trusting in our work, happy selling. el Link to comment Share on other sites More sharing options...
fancy|modules Posted March 4, 2020 Share Posted March 4, 2020 This module also allow different front office defalut currency https://addons.prestashop.com/en/international-localization/45953-default-front-office-currency.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now