Changing the currency icon in Bitrix
Rus
Eng
Изменяем значок валюты в Битрикс

All English-language materials have been translated fully automatically using the Google service

The question often arises of replacing the classic price display with your own. If you want to do this throughout the site , then go to Settings-> Currencies-> List of currencies . Go to the Language settings tab and in the "Format string for displaying currency:" fields of the corresponding languages, change rub. to the sign we need

Programmatically change the currency icon in the old template basket

In our component template sale.basket.basket , find the file basket_items.php . For other sections of the basket, edit other files. Somewhere in the beginning, we write, relying on our currencies:

 $ currency = $ _COOKIE ['currency']; // Take the current currency from cookies

// Write the currency icon to the $ pound variable
if ($ currency == 'DKK')
   $ pound = 'D.Kr.';
if ($ currency == 'SEK')
   $ pound = 'S.Kr.';
if ($ currency == 'NOK')
   $ pound = 'N.Kr.';

// Connect the module for cost conversion
CModule :: IncludeModule ('currency'); </code> </pre>
<pre><code> // Display in hidden inputs the currency icon and the conversion factor from the base currency (in my case, the base "GBP").
// These lines are needed to recalculate the prices in the basket using ajax. Ajax needs to be edited separately with great pain. I will not quote here.
<input id = "currencytext" type = "text" hidden value = "<? = $ pound?>" />
<input id = "currencyrate" type = "text" hidden value = "<? = CCurrencyRates :: GetConvertFactor ($ currency," GBP ");?>"> 

Next, where there is a price display in the template, write this type of code

 
if ($ arItem ["CURRENCY"]! = $ currency) {// If we switched the currency from the base
   // Convert the unformatted price, write it to $ intotal
   $ intotal = CCurrencyRates :: ConvertCurrency ($ arItem ["PRICE"], "GBP", $ currency);
   // Remove unnecessary characters, leave 2 characters after the point
   $ intotal2 = substr ($ intotal, 0, strripos ($ intotal, '.') + 3);
   // Display the new formatted value in $ currency
   echo $ pound. ' '.intotal2
}
// If the currency is base, then we can immediately display the formatted price
else {
   echo $ arItem ["PRICE_FORMATED"]
}?>  

Comments

There are no comments yet, you can be the first to leave it

Leave a comment

The site uses a comment pre-moderation system, so your message will be published only after approval by the moderator

You are replying to a user's comment

Send

FEEDBACK

Email me

Are you developing a new service, making improvements to the existing one and want to be better than your competitors? You have come to the right place. I offer you a comprehensive studio-level website development. From me you can order design, layout, programming, development of non-traditional functionality, implementation of communication between CMS, CRM and Data Analitics, as well as everything else related to sites, except for promotion.

Contact, I will always advise on all questions and help you find the most effective solution for your business. I am engaged in the creation of sites in Novosibirsk and in other regions of Russia, I also work with the CIS countries. You will be satisfied with our cooperation

An error occurred while sending, please try again after a while
Message sent successfully

Phones

+7(993) 007-18-96

Email

info@tichiy.ru

Address

Россия, г. Москва

By submitting the form, you automatically confirm that you have read and accept the Privacy Policy site

Contact with me
Send message
By submitting the form, you automatically confirm that you have read and accept Privacy policy of site
Sending successful!
Thank you for contacting :) I will contact you as soon as possible
Sending failed
An error occurred while sending the request. Please wait and try again after a while or call my phone number