public function getInputType()
{
$inputType = 'string';
$selectAttributes = ['attribute_set_id', 'stock.is_in_stock', 'has_image', 'price.is_discount'];
if (in_array($this->getAttribute(), $selectAttributes)) {
$inputType = 'select';
} elseif ($this->getAttribute() === 'price') {
$inputType = 'numeric';
} elseif (is_object($this->getAttributeObject())) {
$frontendInput = $this->getAttributeObject()->getFrontendInput();
if ($this->getAttributeObject()->getAttributeCode() === 'category_ids') {
$inputType = 'category';
} elseif (in_array($frontendInput, ['select', 'multiselect'])) {
$inputType = 'multiselect';
} elseif ($frontendInput === 'date') {
$inputType = 'date';
} elseif ($frontendInput === 'boolean') {
$inputType = 'boolean';
}
}
return $inputType;
}
/** * Retrieve ES mapping field name used for the current condition (including analyzer). * * @param ProductCondition $productCondition Product condition. * * @return string */ private function getSearchFieldName(ProductCondition $productCondition) { $attributeName = $productCondition->getAttribute(); $field = $this->attributeList->getField($attributeName); $analyzer = FieldInterface::ANALYZER_UNTOUCHED; if ($productCondition->getInputType() === "string") { $analyzer = FieldInterface::ANALYZER_STANDARD; } return $field->getMappingProperty($analyzer); }