コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getItemsData(array $intervals = [], $additionalRequestData = '')
 {
     $collection = $this->layer->getProductCollection();
     $appliedInterval = $intervals;
     if ($appliedInterval && $collection->getPricesCount() <= $this->getIntervalDivisionLimit()) {
         return [];
     }
     $this->algorithm->setStatistics($collection->getMinPrice(), $collection->getMaxPrice(), $collection->getPriceStandardDeviation(), $collection->getPricesCount());
     if ($appliedInterval) {
         if ($appliedInterval[0] == $appliedInterval[1] || $appliedInterval[1] === '0') {
             return [];
         }
         $this->algorithm->setLimits($appliedInterval[0], $appliedInterval[1]);
     }
     $interval = $this->intervalFactory->create();
     $items = [];
     foreach ($this->algorithm->calculateSeparators($interval) as $separator) {
         $items[] = ['label' => $this->render->renderRangeLabel($separator['from'], $separator['to']), 'value' => ($separator['from'] == 0 ? '' : $separator['from']) . '-' . $separator['to'] . $additionalRequestData, 'count' => $separator['count']];
     }
     return $items;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function getInterval(BucketInterface $bucket, array $dimensions, \Magento\Framework\Search\Dynamic\EntityStorage $entityStorage)
 {
     $select = $this->dataProvider->getDataSet($bucket, $dimensions, $entityStorage->getSource());
     return $this->intervalFactory->create(['select' => $select]);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getInterval(BucketInterface $bucket, array $dimensions, array $entityIds)
 {
     $select = $this->dataProvider->getDataSet($bucket, $dimensions);
     $select->where('main_table.entity_id IN (?)', $entityIds);
     return $this->intervalFactory->create(['select' => $select]);
 }