Definition at line 13 of file Price.php.
◆ __construct()
- Parameters
-
Layer | $layer | |
Registry | $coreRegistry | |
ScopeConfigInterface | $scopeConfig | |
\Magento\Catalog\Model\ResourceModel\Layer\Filter\Price | $resource | |
Definition at line 93 of file Price.php.
99 $this->layer = $layer;
100 $this->coreRegistry = $coreRegistry;
101 $this->scopeConfig = $scopeConfig;
102 $this->resource = $resource;
◆ getAdditionalRequestData()
getAdditionalRequestData |
( |
| ) |
|
- Returns
- string
Definition at line 369 of file Price.php.
373 if ($appliedInterval) {
374 $result =
',' . $appliedInterval[0] .
'-' . $appliedInterval[1];
376 if ($priorIntervals) {
377 $result .=
',' . $priorIntervals;
◆ getInterval()
- Returns
- array
Definition at line 108 of file Price.php.
110 return $this->interval;
◆ getIntervalDivisionLimitValue()
getIntervalDivisionLimitValue |
( |
| ) |
|
Get interval division limit
- Returns
- int
Definition at line 160 of file Price.php.
162 return $this->scopeConfig->getValue(
163 self::XML_PATH_INTERVAL_DIVISION_LIMIT,
164 ScopeInterface::SCOPE_STORE
◆ getLayer()
◆ getMaxPrice()
Get maximum price from layer products set
- Returns
- float
Definition at line 264 of file Price.php.
266 $maxPrice = $this->maxPrice;
267 if ($maxPrice ===
null) {
269 ->getProductCollection()
271 $maxPrice = floor($maxPrice);
272 $this->maxPrice = $maxPrice;
◆ getOnePriceIntervalValue()
getOnePriceIntervalValue |
( |
| ) |
|
- Returns
- mixed
Definition at line 147 of file Price.php.
149 return $this->scopeConfig->getValue(
150 self::XML_PATH_ONE_PRICE_INTERVAL,
151 ScopeInterface::SCOPE_STORE
◆ getPriceRange()
Get price range for building filter steps
- Returns
- int
Definition at line 194 of file Price.php.
196 $range = $this->priceRange;
198 $currentCategory = $this->coreRegistry->registry(
'current_category_filter');
199 if ($currentCategory) {
200 $range = $currentCategory->getFilterPriceRange();
203 ->getCurrentCategory()
204 ->getFilterPriceRange();
210 if ($calculation == self::RANGE_CALCULATION_AUTO) {
213 $range = pow(10, strlen(floor($maxPrice)) -
$index);
216 }
while ($range > self::MIN_RANGE_POWER && count(
$items) < 2);
222 $this->priceRange = $range;
getRangeItemCounts($range)
getRangeCalculationValue()
◆ getPriorFilters()
getPriorFilters |
( |
|
$filterParams | ) |
|
- Parameters
-
- Returns
- array
Definition at line 282 of file Price.php.
285 $count = count($filterParams);
289 $priorFilters[] = $priorFilter;
297 return $priorFilters;
◆ getPriorIntervals()
- Returns
- array
Definition at line 344 of file Price.php.
346 return $this->priorIntervals;
◆ getRangeCalculationValue()
getRangeCalculationValue |
( |
| ) |
|
- Returns
- mixed
Definition at line 125 of file Price.php.
127 return $this->scopeConfig->getValue(
128 self::XML_PATH_RANGE_CALCULATION,
129 ScopeInterface::SCOPE_STORE
◆ getRangeItemCounts()
getRangeItemCounts |
( |
|
$range | ) |
|
Get information about products count in range
- Parameters
-
- Returns
- int
Definition at line 234 of file Price.php.
236 $items = array_key_exists($range, $this->rangeItemCounts) ? $this->rangeItemCounts[$range] :
null;
238 $items = $this->resource->getCount($range);
244 foreach (
$items as $k => $v) {
246 if ($calculation == self::RANGE_CALCULATION_MANUAL &&
$i > 1 &&
$i > $maxIntervalsNumber) {
253 $this->rangeItemCounts[$range] =
$items;
getRangeCalculationValue()
getRangeMaxIntervalsValue()
◆ getRangeMaxIntervalsValue()
getRangeMaxIntervalsValue |
( |
| ) |
|
Get maximum number of intervals
- Returns
- mixed
Definition at line 173 of file Price.php.
175 return $this->scopeConfig->getValue(
176 self::XML_PATH_RANGE_MAX_INTERVALS,
177 ScopeInterface::SCOPE_STORE
◆ getRangeStepValue()
- Returns
- mixed
Definition at line 136 of file Price.php.
138 return $this->scopeConfig->getValue(
139 self::XML_PATH_RANGE_STEP,
140 ScopeInterface::SCOPE_STORE
◆ getResetValue()
Get filter value for reset current filter state
- Returns
- null|string
Definition at line 326 of file Price.php.
330 if ($priorIntervals) {
331 foreach ($priorIntervals as $priorInterval) {
332 $value[] = implode(
'-', $priorInterval);
335 return implode(
',',
$value);
◆ getResource()
- Returns
- \Magento\Catalog\Model\ResourceModel\Layer\Filter\Price
Definition at line 361 of file Price.php.
363 return $this->resource;
◆ setInterval()
- Parameters
-
- Returns
- void
Definition at line 117 of file Price.php.
119 $this->interval = $interval;
◆ setPriorIntervals()
setPriorIntervals |
( |
|
$priorInterval | ) |
|
- Parameters
-
- Returns
- void
Definition at line 353 of file Price.php.
355 $this->priorIntervals = $priorInterval;
◆ validateFilter()
validateFilter |
( |
|
$filter | ) |
|
Validate and parse filter request param
- Parameters
-
- Returns
- array|bool
Definition at line 306 of file Price.php.
308 $filter = explode(
'-', $filter);
309 if (count($filter) != 2) {
312 foreach ($filter as $v) {
313 if ($v !==
'' && $v !==
'0' && (
double)$v <= 0 || is_infinite((
double)$v)) {
◆ MIN_RANGE_POWER
const MIN_RANGE_POWER = 10 |
Minimal size of the range
Definition at line 40 of file Price.php.
◆ RANGE_CALCULATION_AUTO
const RANGE_CALCULATION_AUTO = 'auto' |
Price layered navigation modes: Automatic (equalize price ranges), Automatic (equalize product counts), Manual
Definition at line 31 of file Price.php.
◆ RANGE_CALCULATION_IMPROVED
const RANGE_CALCULATION_IMPROVED = 'improved' |
◆ RANGE_CALCULATION_MANUAL
const RANGE_CALCULATION_MANUAL = 'manual' |
◆ XML_PATH_INTERVAL_DIVISION_LIMIT
const XML_PATH_INTERVAL_DIVISION_LIMIT = 'catalog/layered_navigation/interval_division_limit' |
◆ XML_PATH_ONE_PRICE_INTERVAL
const XML_PATH_ONE_PRICE_INTERVAL = 'catalog/layered_navigation/one_price_interval' |
◆ XML_PATH_RANGE_CALCULATION
const XML_PATH_RANGE_CALCULATION = 'catalog/layered_navigation/price_range_calculation' |
XML configuration paths for Price Layered Navigation
Definition at line 18 of file Price.php.
◆ XML_PATH_RANGE_MAX_INTERVALS
const XML_PATH_RANGE_MAX_INTERVALS = 'catalog/layered_navigation/price_range_max_intervals' |
◆ XML_PATH_RANGE_STEP
const XML_PATH_RANGE_STEP = 'catalog/layered_navigation/price_range_step' |
The documentation for this class was generated from the following file:
- vendor/magento/module-catalog/Model/Layer/Filter/DataProvider/Price.php