Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Disable checking for config in new suggestion data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Hnto committed May 19, 2021
1 parent f9dc58f commit 07c3ae8
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions Model/Autocomplete/DataProvider/SuggestionDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,22 @@ public function getItems()
$category = $this->dataProviderHelper->getCategory();
$promises = [];

if ($this->config->isAutocompleteSuggestionsEnabled()) {
$suggestionsRequest = $this->suggestionRequestFactory->create();
$suggestionsRequest->setSearch($query);
$suggestionsRequest->addCategoryFilter($category);
$promises['suggestions'] = $this->client->request(
$suggestionsRequest,
true
);
}

if ($this->config->isAutocompleteProductsEnabled()) {
/** @var ProductSuggestionsRequest $productSuggestionRequest */
$productSuggestionsRequest = $this->productSuggestionRequestFactory->create();
$productSuggestionsRequest->setSearch($query);
$productSuggestionsRequest->addCategoryFilter($category);
$promises['product_suggestions'] = $this->client->request(
$productSuggestionsRequest,
true
);
}
$suggestionsRequest = $this->suggestionRequestFactory->create();
$suggestionsRequest->setSearch($query);
$suggestionsRequest->addCategoryFilter($category);
$promises['suggestions'] = $this->client->request(
$suggestionsRequest,
true
);

/** @var ProductSuggestionsRequest $productSuggestionRequest */
$productSuggestionsRequest = $this->productSuggestionRequestFactory->create();
$productSuggestionsRequest->setSearch($query);
$productSuggestionsRequest->addCategoryFilter($category);
$promises['product_suggestions'] = $this->client->request(
$productSuggestionsRequest,
true
);

if (empty($promises)) {
return [];
Expand Down

0 comments on commit 07c3ae8

Please sign in to comment.