|
18 | 18 | class Price extends AbstractFilter
|
19 | 19 | {
|
20 | 20 | /** Price delta for filter */
|
21 |
| - public const PRICE_DELTA = 0.01; |
| 21 | + const PRICE_DELTA = 0.001; |
22 | 22 |
|
23 | 23 | /**
|
24 | 24 | * @var \Magento\Catalog\Model\Layer\Filter\DataProvider\Price
|
@@ -142,7 +142,7 @@ public function apply(\Magento\Framework\App\RequestInterface $request)
|
142 | 142 |
|
143 | 143 | $this->getLayer()->getProductCollection()->addFieldToFilter(
|
144 | 144 | 'price',
|
145 |
| - ['from' => $from, 'to' => $to] |
| 145 | + ['from' => $from, 'to' => empty($to) || $from == $to ? $to : $to - self::PRICE_DELTA] |
146 | 146 | );
|
147 | 147 |
|
148 | 148 | $this->getLayer()->getState()->addFilter(
|
@@ -190,6 +190,10 @@ protected function _renderRangeLabel($fromPrice, $toPrice, $isLast = false)
|
190 | 190 | } elseif ($fromPrice == $toPrice && $this->dataProvider->getOnePriceIntervalValue()) {
|
191 | 191 | return $formattedFromPrice;
|
192 | 192 | } else {
|
| 193 | + if ($fromPrice != $toPrice) { |
| 194 | + $toPrice -= .01; |
| 195 | + } |
| 196 | + |
193 | 197 | return __('%1 - %2', $formattedFromPrice, $this->priceCurrency->format($toPrice));
|
194 | 198 | }
|
195 | 199 | }
|
@@ -270,9 +274,6 @@ protected function getFrom($from)
|
270 | 274 | private function prepareData($key, $count, $isLast = false)
|
271 | 275 | {
|
272 | 276 | [$from, $to] = explode('_', $key);
|
273 |
| - if (!$isLast && !empty($to) && $to != $from) { |
274 |
| - $to -= self::PRICE_DELTA; |
275 |
| - } |
276 | 277 | $label = $this->_renderRangeLabel($from, $to, $isLast);
|
277 | 278 | $value = $from . '-' . $to . $this->dataProvider->getAdditionalRequestData();
|
278 | 279 |
|
|
0 commit comments