WebSite X5Help Center

 
Yavor R.
Yavor R.
User

The possibility of displaying prices in two currencies  en

Автор: Yavor R.
Просмотрено 185, Подписчики 1, Размещенный 0  

Hello,
Is it possible to display prices (product, cart, order, invoice, etc.) in two currencies everywhere?

In connection with the introduction of the Euro as a currency in Bulgaria, there is a requirement for prices to be shown in BGN and € at the fixed exchange rate of 1.95583 BGN for 1 €. They must be in the same font and size. This requirement came into effect this week and will remain in force until 31 December 2026.

Thank you in advance!

Размещено
9 Ответы
Daniel W.
Daniel W.
User
Лучший пользователь месяца DE

Maybe KolAsin (moderator) could provide an EXTRA code here, but he would need a link to the shop.

Читать больше
Размещено От Daniel W.
Yavor R.
Yavor R.
User
Автор

Thank you, Daniel!
We don’t have such a project online, but we are exploring the possibilities for our clients. We want to use WebSite X5 for them. At the moment, there is a working solution for OpenCart3, and the stores are running there.

My personal opinion is that you should add dual currency display in WebSite X5, because within the European Union, six member states have not yet adopted the euro and continue to use their own national currencies: the Czech Republic, Denmark, Hungary, Poland, Romania, and Sweden. Of these, all except Denmark are legally committed to adopting the euro once they meet the required convergence criteria. As I mentioned, Bulgaria will start using the euro from 01.01.2026.

Читать больше
Размещено От Yavor R.
Axel  
Axel  
User
Лучший пользователь месяца EN

Hello With the link posted by KolAsim wink I have this one by example

The code to add into the catalog page properties is here

And the full modified code is.


<script>
/** A script to display the price from ethe catalog page and to add another information price in other currency **/
/** The price into the cart will be ALWAYS in Euros in our case. Currency choosen during project creation **/
/** -- calcolo e aggiunta IVA x WSx5 by KolAsim -- **/


$(document).ready(function () {//K<;
setTimeout(() => {//K1>;
$('.im-cc-wrapper-row').each(function () {//K2>;
const rawPrice = $(this).text();
const priceCleaned = rawPrice.replace(/\s/g, '').replace('€', '');
const price = parseInt(priceCleaned);

if (isNaN(price)) return;

const changevalue = 0.51; // for the change value. . 0.51 is the actual value for change with bulgarian currency

const euros = Math.round(price); // Price in Euros
const lev = Math.round(price * changevalue); // Price in BGN for Bulgarian currency. 0.51 is the value for change

const formatEur = num => num.toLocaleString('fr-FR').replace(/\./g, ' ') + ' €';
const formatFt = num => num.toLocaleString('bg-BG').replace(/\./g, ' ') + ' лев';

// To display price infos in Euros & BGN
const ivaHtml = `
<div class="vat-calculation" style="font-weight:normal;font-size:12px">
Euros: <strong>${formatEur(euros)}</strong><br>
Info in Lev: <strong>${formatFt(lev)}</strong>
</div>`;

$(this).append(ivaHtml);

});//K2<<;
}, 800);//K1<<;
});//K<<;
</script>

Hope this helps...

Now you have the hand to modify it.

Axel

Читать больше
Размещено От Axel  
Yavor R.
Yavor R.
User
Автор

Thank you!

I tested the script locally with one store. It works on:

E-commerce: Search

E-commerce: Product Page

But it doesn’t work on E-commerce: Cart and Checkout.

In the Live Demo it works here:
https://wsx5demo.afsoftware.fr/boutik.php

But not here:
https://wsx5demo.afsoftware.fr/cart/index.html
and on product pages such as:
https://wsx5demo.afsoftware.fr/product/?specific-product

We need to meet the requirement of displaying prices in two currencies (BGN and EUR) across all parts of the website - product pages, cart, order, invoice, etc.

Could you please advise how to enable the script on Cart/Checkout pages?

Читать больше
Размещено От Yavor R.
Daniel W.
Daniel W.
User
Лучший пользователь месяца DE

KolAsim once mentioned that JavaScript cannot interfere with the shopping cart calculations; in that case, the developers of WebSite X5 would have to do it.

Читать больше
Размещено От Daniel W.
Yavor R.
Yavor R.
User
Автор

Yes, it would be great if they accept the idea. Many stores will need this.
Thanks to everyone who helped!
Have a great day/night!

Читать больше
Размещено От Yavor R.
Axel  
Axel  
User
Лучший пользователь месяца EN

Hope that new feature will see the day !!!! laughing in nearest release

Читать больше
Размещено От Axel