Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function execute(string $sku, int $stockId): ?array
GetStockItemDataInterface::IS_SALABLE => 'stock_status',
]
)->where('product_id = ?', $productId);

return $connection->fetchRow($select) ?: null;
} else {
$stockItemTableName = $this->stockIndexTableNameResolver->execute($stockId);
$select->from(
Expand All @@ -85,18 +87,16 @@ public function execute(string $sku, int $stockId): ?array
GetStockItemDataInterface::IS_SALABLE => IndexStructure::IS_SALABLE,
]
)->where(IndexStructure::SKU . ' = ?', $sku);
}

try {
if ($connection->isTableExists($stockItemTableName)) {
return $connection->fetchRow($select) ?: null;
}
try {
if ($connection->isTableExists($stockItemTableName)) {
return $connection->fetchRow($select) ?: null;
}

return null;
} catch (\Exception $e) {
throw new LocalizedException(__(
'Could not receive Stock Item data'
), $e);
return null;
} catch (\Exception $e) {
throw new LocalizedException(__('Could not receive Stock Item data'), $e);
}
}
}
}