getRequestVar() !== 'price') { return [$filter]; } $collection = $filter->getLayer()->getProductCollection(); if (!method_exists($collection, 'getFacetedData')) { $subject->setData('esun_price_step_ranges', []); return [$filter]; } $ranges = []; foreach ($collection->getFacetedData('price') as $bucket) { $count = (int)($bucket['count'] ?? 0); if ($count <= 0) { continue; } $value = (string)($bucket['value'] ?? ''); $from = $bucket['from'] ?? null; $to = $bucket['to'] ?? null; if (($from === null || $to === null) && str_contains($value, '_')) { [$fromValue, $toValue] = explode('_', $value, 2); $from = $fromValue === '*' ? null : (float)$fromValue; $to = $toValue === '*' ? null : (float)$toValue; } if ($from === null && $to === null) { continue; } $ranges[] = [ 'from' => $from === null ? '' : (float)$from, 'to' => $to === null ? '' : (float)$to, 'count' => $count, 'value' => $value, ]; } usort($ranges, static function (array $left, array $right): int { return (float)$left['from'] <=> (float)$right['from']; }); $subject->setData('esun_price_step_ranges', $ranges); return [$filter]; } }