From 1a4e99d35be922ecd6c293a918e19793c7b1c715 Mon Sep 17 00:00:00 2001 From: ah-net <103565001+ah-net@users.noreply.github.com> Date: Tue, 30 Aug 2022 11:55:30 +0200 Subject: [PATCH] Update DataProviderHelper.php Fixes #265 --- Model/Autocomplete/DataProviderHelper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Model/Autocomplete/DataProviderHelper.php b/Model/Autocomplete/DataProviderHelper.php index aacfb12d..e8048cf5 100644 --- a/Model/Autocomplete/DataProviderHelper.php +++ b/Model/Autocomplete/DataProviderHelper.php @@ -144,10 +144,12 @@ public function getProductItems(AutocompleteProductResponseInterface $response) $result = []; foreach ($response->getProductData() as $item) { $product = $productCollection->getItemById($item['id']); - $product->setData('tweakwise_price', $item['tweakwise_price']); + if (!$product) { continue; } + + $product->setData('tweakwise_price', $item['tweakwise_price']); $result[] = $this->productItemFactory->create(['product' => $product]); }