Hello, we are required to display 2 prices in euros and leva.
For amounts over 1000 leva it shows me 1 leva.
Prestashop 1.6
At the end of global.js I have put this code.
const rate = 1.92583;
function convertBGNtoEUR(selector) {
$(selector).each(function () {
let text = $(this).text().trim();
let bgn = parseFloat(text.replace(',', '.'));
if (isNaN(bgn)) return;
if ($(this).html().includes('€')) return;
let eur = (bgn / rate).toFixed(2);
let bgnFormatted = bgn.toFixed(2).replace('.', ',');
$(this).html(bgnFormatted + ' лв / <span class="eur">€' + eur + '</span>');
});
}
$(document).ready(function () {
convertBGNtoEUR('.content_price .product-price, .content_price .old-price');
convertBGNtoEUR('#our_price_display, #unit_price_display');
const observer = new MutationObserver(function () {
convertBGNtoEUR('.content_price .product-price, .content_price .old-price');
convertBGNtoEUR('#our_price_display, #unit_price_display');
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
https://beautyandpower.eu/244-masazhni-stolove
Thanks in advance.