shacker Posted July 10, 2015 Share Posted July 10, 2015 In this tutorial, we show how to disable currencies in the front office. Imagine that you have 2 currencies in back office, but you only want to show 1 currency in the back office. The currencies are EUR and ARS as example. You need to open the modules/blockcurrencies/blockcurrencies.tpl, or check if you have the file in your theme folder themes/yourthemename/blockcurrencies/blockcurrencies.tpl The original code must looks liek this (in PS 1.6) {if count($currencies) > 1}<div id="currencies-block-top"><form id="setCurrency" action="{$request_uri}" method="post"><div class="current"><input type="hidden" name="id_currency" id="id_currency" value=""/><input type="hidden" name="SubmitCurrency" value="" /><span class="cur-label">{l s='Currency' mod='blockcurrencies'} :</span>{foreach from=$currencies key=k item=f_currency}{if $cookie->id_currency == $f_currency.id_currency}<strong>{$f_currency.iso_code}</strong>{/if}{/foreach}</div><ul id="first-currencies" class="currencies_ul toogle_content">{foreach from=$currencies key=k item=f_currency}{if strpos($f_currency.name, '('|cat:$f_currency.iso_code:')') === false}{assign var="currency_name" value={l s='%s (%s)' sprintf=[$f_currency.name, $f_currency.iso_code][spam-filter]{else}{assign var="currency_name" value=$f_currency.name}{/if}<li {if $cookie->id_currency == $f_currency.id_currency}class="selected"{/if}><a href="javascript:setCurrency({$f_currency.id_currency});" rel="nofollow" title="{$currency_name}">{$currency_name}</a></li>{/foreach}</ul></form></div>{/if} The variable that contains the ID of the currenci is $f_currency.id_currency, so we can use an IF statment to show only 1 currency adding: {if $f_currency.id_currency eq 1} Where 1 is the ID of the currency to show. Full code: {if count($currencies) > 1}<div id="currencies-block-top"><form id="setCurrency" action="{$request_uri}" method="post"><div class="current"><input type="hidden" name="id_currency" id="id_currency" value=""/><input type="hidden" name="SubmitCurrency" value="" /><span class="cur-label">{l s='Currency' mod='blockcurrencies'} :</span>{foreach from=$currencies key=k item=f_currency}{if $f_currency.id_currency eq 1}{if $cookie->id_currency == $f_currency.id_currency}<strong>{$f_currency.iso_code}</strong>{/if}{/if}{/foreach}</div><ul id="first-currencies" class="currencies_ul toogle_content">{foreach from=$currencies key=k item=f_currency}{if strpos($f_currency.name, '('|cat:$f_currency.iso_code:')') === false}{assign var="currency_name" value={l s='%s (%s)' sprintf=[$f_currency.name, $f_currency.iso_code][spam-filter]{else}{assign var="currency_name" value=$f_currency.name}{/if}{if $f_currency.id_currency eq 1}<li {if $cookie->id_currency == $f_currency.id_currency}class="selected"{/if}><a href="javascript:setCurrency({$f_currency.id_currency});" rel="nofollow" title="{$currency_name}">{$currency_name}</a></li>{/if}{/foreach}</ul></form></div>{/if} Link to comment Share on other sites More sharing options...
Designinfo Posted August 25, 2015 Share Posted August 25, 2015 Page stopped loading because of this. Please change it . Link to comment Share on other sites More sharing options...
shacker Posted August 25, 2015 Author Share Posted August 25, 2015 check the error that you have. enable display errors on the defines.inc.php file Link to comment Share on other sites More sharing options...
Designinfo Posted August 25, 2015 Share Posted August 25, 2015 I dont know what error this is but nothing was loading. I was getting blank pages. Link to comment Share on other sites More sharing options...
shacker Posted August 29, 2015 Author Share Posted August 29, 2015 with display errors you can see the error and post here to check Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2015 Share Posted August 29, 2015 I dont know what error this is but nothing was loading. I was getting blank pages. check this topic https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/ Link to comment Share on other sites More sharing options...
Chriss_44 Posted September 1, 2015 Share Posted September 1, 2015 (edited) I have USD and Mexican Pesos. I used your code and it doest remove USD, but I need to display Mexican pesos as the mainly currency for new visitors. I can´t change default currency from USD to Pesos cause all my prices are in USD and they change everyday can someone help me ? Edited September 1, 2015 by Chriss_44 (see edit history) Link to comment Share on other sites More sharing options...
myselfidem Posted September 1, 2015 Share Posted September 1, 2015 (edited) Hello, "In this tutorial, we show how to disable currencies in the front office. Imagine you have two currencies in back office, but you want to show 1 currency in the back office." It would be to show 1 currency in the front office or I'm wrong ? Edited September 1, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted September 1, 2015 Author Share Posted September 1, 2015 I have USD and Mexican Pesos. I used your code and it doest remove USD, but I need to display Mexican pesos as the mainly currency for new visitors. I can´t change default currency from USD to Pesos cause all my prices are in USD and they change everyday can someone help me ? You only need to change the currendies ID of the example for your currency ID Hello, "In this tutorial, we show how to disable currencies in the front office. Imagine you have two currencies in back office, but you want to show 1 currency in the back office." It would be to show 1 currency in the front office or I'm wrong ? 1 currency or more, this example disable only 1 currency from front office Link to comment Share on other sites More sharing options...
myselfidem Posted September 2, 2015 Share Posted September 2, 2015 (edited) Thanks shaker, But using this method, I have only 1 currency on my front office with the ID selected and 3 currencies are installed ! Friendly Edited September 2, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted September 2, 2015 Author Share Posted September 2, 2015 Hoy many currencies do you have in the back office? and wich IDs? Link to comment Share on other sites More sharing options...
myselfidem Posted September 2, 2015 Share Posted September 2, 2015 (edited) Hello, I have 3 currencies on the Back-Office : ID = 1 CHF Franc ID = 2 USD Dollar $ ID = 3 Euro And using the new file I have only CHF Franc (ID = 1) currency on my front office. Thank you Edited September 2, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
Chriss_44 Posted September 2, 2015 Share Posted September 2, 2015 You only need to change the currendies ID of the example for your currency ID 1 currency or more, this example disable only 1 currency from front office I have disabled USD on my front office now clients only see prices on MXN thats what i wanted but here is the problem: When a new customer enters the shop it sees the prices on USD (cause my default currency is USD) and I want them to enter the shop and see prices on MXN. Cuase I´m running an Adwords campaign I don´t want new people see prices on USD. Link to comment Share on other sites More sharing options...
shacker Posted September 6, 2015 Author Share Posted September 6, 2015 you can change this part of the code {if $f_currency.id_currency eq 1} to {if $f_currency.id_currency eq 1 or $f_currency.id_currency eq 2} That code enables the currency 1 and 2 and hide the 3 2 Link to comment Share on other sites More sharing options...
lauromolina Posted September 8, 2015 Share Posted September 8, 2015 you can change this part of the code {if $f_currency.id_currency eq 1} to {if $f_currency.id_currency eq 1 or $f_currency.id_currency eq 2} That code enables the currency 1 and 2 and hide the 3 Hi, I need to hide currency 2 and only show only currency 1 on the front end. can you help me out with the code? also, the line you mention shows twice in the code, should i replace it on both places? Link to comment Share on other sites More sharing options...
myselfidem Posted September 9, 2015 Share Posted September 9, 2015 Hello, You can use the example given at the top and copy twice : {if $f_currency.id_currency eq 1} This will hide all currencies except the one you choose ! Don't forget to check the ID for the currency ! Tested and works fine Link to comment Share on other sites More sharing options...
lauromolina Posted September 9, 2015 Share Posted September 9, 2015 Hello, You can use the example given at the top and copy twice : {if $f_currency.id_currency eq 1} This will hide all currencies except the one you choose ! Don't forget to check the ID for the currency ! Tested and works fine Hi, that is exactly what I did and it does hide currency #2 from the currency selection box but the prices still show in currency #2, until you manually change them: please see for yourself http://laimportaderia.com/ Link to comment Share on other sites More sharing options...
myselfidem Posted September 9, 2015 Share Posted September 9, 2015 (edited) Here is my file working fine : {if count($currencies) > 1} <div id="currencies-block-top"> <form id="setCurrency" action="{$request_uri}" method="post"> <div class="current"> <input type="hidden" name="id_currency" id="id_currency" value=""/> <input type="hidden" name="SubmitCurrency" value="" /> <span class="cur-label">{l s='Currency' mod='blockcurrencies'} :</span> {foreach from=$currencies key=k item=f_currency} {if $f_currency.id_currency eq 1} {if $cookie->id_currency == $f_currency.id_currency}<strong>{$f_currency.iso_code}</strong>{/if} {/if} {/foreach} </div> <ul id="first-currencies" class="currencies_ul toogle_content"> {foreach from=$currencies key=k item=f_currency} {if strpos($f_currency.name, '('|cat:$f_currency.iso_code:')') === false} {assign var="currency_name" value={l s='%s (%s)' sprintf=[$f_currency.name, $f_currency.iso_code][spam-filter] {else} {assign var="currency_name" value=$f_currency.name} {/if} {if $f_currency.id_currency eq 1} <li {if $cookie->id_currency == $f_currency.id_currency}class="selected"{/if}> <a href="javascript:setCurrency({$f_currency.id_currency});" rel="nofollow" title="{$currency_name}"> {$currency_name} </a> </li> {/if} {/foreach} </ul> </form> </div> {/if} Remember to clear the cache ! Edited September 9, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
lauromolina Posted September 10, 2015 Share Posted September 10, 2015 thank you, that is exactly the same code I am using. And it works to limited extend. My default currency has id = 2 In the front end I only wish to show currency id = 1 currently the first time a user loads the site it loads currency 2. once they change to 1 they cannot go back to 2. is there a way to set currenyid to 1 everytime without the user having to change it ? Link to comment Share on other sites More sharing options...
myselfidem Posted September 10, 2015 Share Posted September 10, 2015 (edited) Well, I tested and installed on local Peso Mexico (MXN). You can convert to Dollars ; Euro ; etc. If you have selected ID currency 1 (MXN) you see Dollars and it's right ! You can browse to : Localisation | Import |Mexico (Taxes, Devises, Unités monétaires and look at the change !! I can see on your background site : var currency = {"id":1,"name":"Peso","iso_code":"MXN","iso_code_num":"484","sign":"$","blank":"1","conversion_rate":"16.750112","deleted":"0","format":"1","decimals":"1","active":"1","prefix":"$ ","suffix":"","id_shop_list":null,"force_id":false}; Friendly Your configuration is OK. Edited September 13, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
lauromolina Posted September 10, 2015 Share Posted September 10, 2015 Negative. I see how you are confused. Both Mexican Pesos and USD have the same simbol $ the site is loading with USD. (open from new browser or clear cookies and see) I need to display MXN since the begining: Link to comment Share on other sites More sharing options...
myselfidem Posted September 11, 2015 Share Posted September 11, 2015 (edited) Yes, you're right ! Mexican Peso and USD have the same symbol... And United States of America copied the Mexican symbol ! https://vivre.aumexique.com/payer-en-dollars-ou-en-pesos-au-mexique/ Tested on local and works fine for me ! PS 1.6.0.6 I can see for Dollars the symbol is on the left and for MXN Pesos the symbol is on the right place ! Because the default currency - in your case - is Dollars and customers need to change the currency with MXN for the first time. It would be useful to change the default currency to MXN in your case ! You can do this change inside your Back-Office : Localization | Setting | and change : Default language , Default currency, etc. Remember to clear the cache ! And you will see the currency now is MXN at first load ;-) Edited September 13, 2015 by myselfidem (see edit history) Link to comment Share on other sites More sharing options...
lauromolina Posted September 11, 2015 Share Posted September 11, 2015 That wont work for me because I set my prices in backoffice in currency 2. I want to display only currency 1 in the front end. is there a way to set currency to 1 all the time in the front end only? Link to comment Share on other sites More sharing options...
shacker Posted September 12, 2015 Author Share Posted September 12, 2015 you can use geolocalization to change currency https://www.prestashop.com/forums/topic/333493-currency-based-on-country-ip/ Link to comment Share on other sites More sharing options...
lauromolina Posted September 13, 2015 Share Posted September 13, 2015 you can use geolocalization to change currency https://www.prestashop.com/forums/topic/333493-currency-based-on-country-ip/ Great Tip, thank you! Link to comment Share on other sites More sharing options...
shacker Posted September 13, 2015 Author Share Posted September 13, 2015 iu welcome. regards 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