/** * Build a search query for the current rule. * * @param array $excludedCategories Categories excluded of query building (avoid infinite recursion). * * @return QueryInterface */ public function getSearchQuery($excludedCategories = []) { $searchQuery = parent::getSearchQuery(); if ($this->getAttribute() === 'category_ids') { $searchQuery = $this->getCategorySearchQuery($excludedCategories); } return $searchQuery; }
/** * Update the condition value to ignore empty array items. * * @param ProductCondition $productCondition Product condition. * * @return $this */ private function prepareFieldValue(ProductCondition $productCondition) { $value = $productCondition->getValue(); if (is_array($value)) { $value = array_filter($value); } $productCondition->setValue($value); return $this; }