From 8e7e5c281a14315758375ab68bf6afa04f0cf5e9 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 12 Apr 2024 11:42:03 +0200 Subject: [PATCH] FFWEB-3030: Handle export problem for Multi Source Inventory module --- src/Model/Export/Catalog/Entity/ProductVariation.php | 8 ++++++-- .../Export/Catalog/ProductType/SimpleDataProvider.php | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Model/Export/Catalog/Entity/ProductVariation.php b/src/Model/Export/Catalog/Entity/ProductVariation.php index e65951c8..0ba63506 100644 --- a/src/Model/Export/Catalog/Entity/ProductVariation.php +++ b/src/Model/Export/Catalog/Entity/ProductVariation.php @@ -91,8 +91,12 @@ private function getAvailability(): bool return $this->product->isAvailable(); } - $quantity = $this->stockItem->get($this->product->getId()); + try { + $quantity = $this->stockItem->get($this->product->getId()); - return $quantity->getIsInStock(); + return (bool) $quantity->getIsInStock(); + } catch (\Exception $e) { + return $this->product->isAvailable(); + } } } diff --git a/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php b/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php index 023196cb..9f5b853b 100644 --- a/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php +++ b/src/Model/Export/Catalog/ProductType/SimpleDataProvider.php @@ -70,8 +70,12 @@ private function getAvailability(): bool return $this->product->isAvailable(); } - $quantity = $this->stockItem->get($this->product->getId()); + try { + $quantity = $this->stockItem->get($this->product->getId()); - return $quantity->getIsInStock(); + return (bool) $quantity->getIsInStock(); + } catch (\Exception $e) { + return $this->product->isAvailable(); + } } }