Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getItemsData(array $intervals = [], $additionalRequestData = '')
 {
     $data = [];
     if (empty($intervals)) {
         $range = $this->range->getPriceRange();
         if (!$range) {
             $range = $this->getRange();
             $dbRanges = $this->resource->getCount($range);
             $data = $this->render->renderRangeData($range, $dbRanges);
         }
     }
     return $data;
 }
Ejemplo n.º 2
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;
 }