From 7cb0cf8dc21612761b9e58de600447c12ef340dd Mon Sep 17 00:00:00 2001 From: Nazarn96 Date: Wed, 27 Mar 2019 14:41:42 +0200 Subject: [PATCH 1/2] fix issue-21960 --- app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php index e61a886a41d6f..a5e9f9ef0a331 100644 --- a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php +++ b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php @@ -115,7 +115,7 @@ protected function _getItemsData() } $label = $this->renderRangeLabel( empty($from) ? 0 : $from, - empty($to) ? 0 : $to + empty($to) ? $to : $to ); $value = $from . '-' . $to; From bbe71ef43062429cd3f235ad885cc3a996e7628d Mon Sep 17 00:00:00 2001 From: Nazarn96 Date: Fri, 29 Mar 2019 13:44:55 +0200 Subject: [PATCH 2/2] refactoring --- .../Magento/CatalogSearch/Model/Layer/Filter/Decimal.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php index a5e9f9ef0a331..e9fb1070fedd5 100644 --- a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php +++ b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php @@ -111,12 +111,9 @@ protected function _getItemsData() $from = ''; } if ($to == '*') { - $to = ''; + $to = null; } - $label = $this->renderRangeLabel( - empty($from) ? 0 : $from, - empty($to) ? $to : $to - ); + $label = $this->renderRangeLabel(empty($from) ? 0 : $from, $to); $value = $from . '-' . $to; $data[] = [ @@ -141,7 +138,7 @@ protected function _getItemsData() protected function renderRangeLabel($fromPrice, $toPrice) { $formattedFromPrice = $this->priceCurrency->format($fromPrice); - if ($toPrice === '') { + if ($toPrice === null) { return __('%1 and above', $formattedFromPrice); } else { if ($fromPrice != $toPrice) {