From bf3543b31b241e5b175031563d63cb95eb0dcb10 Mon Sep 17 00:00:00 2001 From: Isabelle Date: Tue, 17 Feb 2026 09:57:47 +0100 Subject: [PATCH] feat(extra-features): Update price_split to be more dynamic Added show_currency bool as a parameter; made the span class and aria-label displaying the currency dynamic for accessibility --- is_themecore/src/Core/Smarty/SmartyHelperFunctions.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php index 88f40bf..dac9b5a 100644 --- a/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php +++ b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php @@ -275,7 +275,7 @@ class SmartyHelperFunctions } - public static function displayPriceSplit($price){ + public static function displayPriceSplit($price, $show_currency = false) { /* Helper to split the price into euros and cents to make it more stylish registered under public_html/modules/is_themecore/src/Hook/Smarty.php @@ -283,15 +283,16 @@ class SmartyHelperFunctions {price_split price=$product.price} */ - //Convert to a string and only keep numbers, commas and dots + $currency_name = \Context::getContext()->currency->name; + $currency_symbol = \Context::getContext()->currency->symbol; $price_string = implode(',', $price); $price_string = preg_replace('/[^0-9,.]/', '', $price_string); // Split by comma and wrap each part in a span $price_parts = explode(',', $price_string); if (count($price_parts) >= 2) { - echo '' . $price_parts[0] . ''; + echo '' . ($show_currency ? $currency_symbol : '') . $price_parts[0] . ''; echo '' . $price_parts[1] . ''; } else { foreach ($price_parts as $part) {