From 07f351322d57eac11677aae39313dcac71862f59 Mon Sep 17 00:00:00 2001 From: rahulshukla-home Date: Fri, 3 Apr 2020 13:31:09 +0530 Subject: [PATCH] revert back changes in format price --- packages/Webkul/Core/src/Core.php | 38 ++++++++----------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/packages/Webkul/Core/src/Core.php b/packages/Webkul/Core/src/Core.php index e8120d01d..9c9827b01 100755 --- a/packages/Webkul/Core/src/Core.php +++ b/packages/Webkul/Core/src/Core.php @@ -471,40 +471,20 @@ class Core return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL); } - /** - * Format and convert price with currency symbol - * - * @param float $price - * @param string $currencyCode - * @return string - */ + /** + * Format and convert price with currency symbol + * + * @param float $price + * @return string + */ public function formatPrice($price, $currencyCode) { - $code = $this->getCurrentCurrency()->code; - - if (is_null($price)) { + if (is_null($price)) $price = 0; - } else { - if ($code != $currencyCode) { - $price = $this->convertPrice($price, $code, $currencyCode); - } - } - $formater = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY); + $formatter = new \NumberFormatter( app()->getLocale(), \NumberFormatter::CURRENCY ); - $symbol = $this->getCurrentCurrency()->symbol; - - if ($symbol) { - if ($this->currencySymbol($currencyCode) == $symbol) { - return $formater->formatCurrency($price, $currencyCode); - } else { - $formater->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol); - - return $formater->format($price); // $this->convertPrice($price, $code) - } - } else { - return $formater->formatCurrency($price, $currencyCode); - } + return $formatter->formatCurrency($price, $currencyCode); } /**