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

Commit

Permalink
Merge pull request #160 from EmicoEcommerce/bug/issue-133669
Browse files Browse the repository at this point in the history
Disable checking for config in new suggestion data provider
  • Loading branch information
stijnbernards authored May 26, 2021
2 parents f9dc58f + 07c3ae8 commit f84897f
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 f84897f

Please sign in to comment.