Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Search
Dynamic
Algorithm
Manual.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Search\Dynamic\Algorithm
;
7
8
use
Magento\Framework\Search\Adapter\OptionsInterface
;
9
use
Magento\Framework\Search\Dynamic\DataProviderInterface
;
10
use
Magento\Framework\Search\Dynamic\EntityStorage
;
11
use
Magento\Framework\Search\Request\BucketInterface
;
12
13
class
Manual
implements
AlgorithmInterface
14
{
18
private
$dataProvider;
19
23
private
$options;
24
29
public
function
__construct
(
DataProviderInterface
$dataProvider,
OptionsInterface
$options)
30
{
31
$this->dataProvider = $dataProvider;
32
$this->options =
$options
;
33
}
34
38
public
function
getItems
(
39
BucketInterface
$bucket,
40
array $dimensions,
41
EntityStorage
$entityStorage
42
) {
43
$range = $this->dataProvider->getRange();
44
$options = $this->options->get();
45
if
(!$range) {
46
$range = $options[
'range_step'
];
47
}
48
$dbRanges = $this->dataProvider->getAggregation($bucket, $dimensions, $range, $entityStorage);
49
$dbRanges = $this->processRange($dbRanges, $options[
'max_intervals_number'
]);
50
$data
= $this->dataProvider->prepareData($range, $dbRanges);
51
52
return
$data
;
53
}
54
60
private
function
processRange(
$items
, $maxIntervalsNumber)
61
{
62
$i
= 0;
63
$lastIndex =
null
;
64
foreach
(
$items
as $k => $v) {
65
++
$i
;
66
if
(
$i
> 1 &&
$i
> $maxIntervalsNumber) {
67
$items
[$lastIndex] += $v;
68
unset(
$items
[$k]);
69
}
else
{
70
$lastIndex = $k;
71
}
72
}
73
74
return
$items
;
75
}
76
}
Magento\Framework\Search\Dynamic\Algorithm
Definition:
AlgorithmInterface.php:6
Magento\Framework\Search\Request\BucketInterface
Definition:
BucketInterface.php:14
Magento\Framework\Search\Adapter\OptionsInterface
Definition:
OptionsInterface.php:12
Magento\Framework\Search\Dynamic\Algorithm\Manual\getItems
getItems(BucketInterface $bucket, array $dimensions, EntityStorage $entityStorage)
Definition:
Manual.php:38
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\Search\Dynamic\Algorithm\Manual
Definition:
Manual.php:13
Magento\Framework\Search\Dynamic\DataProviderInterface
Definition:
DataProviderInterface.php:16
Magento\Framework\Search\Dynamic\Algorithm\AlgorithmInterface
Definition:
AlgorithmInterface.php:16
$i
$i
Definition:
gallery.phtml:31
$options
$options
Definition:
multiple_mixed_products.php:29
Magento\Framework\Search\Dynamic\EntityStorage
Definition:
EntityStorage.php:13
Magento\Framework\Search\Dynamic\Algorithm\Manual\__construct
__construct(DataProviderInterface $dataProvider, OptionsInterface $options)
Definition:
Manual.php:29
$items
$items
Definition:
order_rollback.php:21