/** * {@inheritdoc} */ public function handle(CriteriaPartInterface $criteriaPart, Criteria $criteria, Search $search, ShopContextInterface $context) { $aggregation = new StatsAggregation('price'); $field = $this->fieldMapping->getPriceField($context); $aggregation->setField($field); $search->addAggregation($aggregation); }
/** * {@inheritdoc} */ public function handle(CriteriaPartInterface $criteriaPart, Criteria $criteria, Search $search, ShopContextInterface $context) { /** @var PriceSorting $criteriaPart */ $field = $this->fieldMapping->getPriceField($context); $sort = new FieldSort($field, strtolower($criteriaPart->getDirection())); $search->addSort($sort); }
/** * {@inheritdoc} */ public function handle(CriteriaPartInterface $criteriaPart, Criteria $criteria, Search $search, ShopContextInterface $context) { $field = $this->fieldMapping->getPriceField($context); $range = []; /** @var PriceCondition $criteriaPart */ if ($criteriaPart->getMinPrice()) { $range['gte'] = $criteriaPart->getMinPrice(); } if ($criteriaPart->getMaxPrice()) { $range['lte'] = $criteriaPart->getMaxPrice(); } $filter = new RangeFilter($field, $range); if ($criteria->hasBaseCondition($criteriaPart->getName())) { $search->addFilter($filter); } else { $search->addPostFilter($filter); } }
/** * @param Shop $shop * @return array */ private function getManufacturerMapping(Shop $shop) { return ['properties' => ['id' => ['type' => 'long'], 'name' => $this->fieldMapping->getLanguageField($shop), 'description' => ['type' => 'string'], 'coverFile' => ['type' => 'string'], 'link' => ['type' => 'string'], 'metaTitle' => ['type' => 'string'], 'metaDescription' => ['type' => 'string'], 'metaKeywords' => ['type' => 'string']]]; }
/** * {@inheritdoc} */ public function get(Shop $shop) { return ['properties' => ['id' => ['type' => 'long'], 'name' => $this->fieldMapping->getLanguageField($shop), 'filterable' => ['type' => 'boolean'], 'options' => ['properties' => ['id' => ['type' => 'long'], 'name' => $this->fieldMapping->getLanguageField($shop)]]]]; }
/** * @param Shop $shop * @return array */ public function get(Shop $shop) { return ['properties' => ['id' => ['type' => 'long'], 'title' => $this->fieldMapping->getLanguageField($shop), 'shortDescription' => $this->fieldMapping->getLanguageField($shop), 'longDescription' => $this->fieldMapping->getLanguageField($shop), 'metaTitle' => $this->fieldMapping->getLanguageField($shop), 'metaKeywords' => $this->fieldMapping->getLanguageField($shop), 'metaDescription' => $this->fieldMapping->getLanguageField($shop)]]; }