/** * Get search value for product attribute. * * @param CatalogProductAttribute $attribute * @return string */ protected function getSearchValue(CatalogProductAttribute $attribute) { $searchValue = ''; switch ($attribute->getFrontendInput()) { case 'Multiple Select': case 'Dropdown': foreach ($attribute->getOptions() as $option) { if ($option['is_default'] == 'Yes') { $searchValue = $option['admin']; } } break; case 'Text Field': $searchValue = $attribute->getDefaultValueText(); break; case 'Text Area': $searchValue = $attribute->getDefaultValueTextarea(); break; case 'Date': $searchValue = $attribute->getDefaultValueDate(); break; case 'Yes/No': $searchValue = $attribute->getDefaultValueYesno(); break; } return $searchValue; }