diff --git a/src/Export/Services/SalesChannelService.php b/src/Export/Services/SalesChannelService.php index e3cca712..70e02daf 100644 --- a/src/Export/Services/SalesChannelService.php +++ b/src/Export/Services/SalesChannelService.php @@ -40,10 +40,12 @@ public function getSalesChannelContext( $currentContext->getContext() ); + $salesChannelContext = null; + /** @var FinSearchConfigEntity $systemConfigEntity */ foreach ($systemConfigEntities as $systemConfigEntity) { if ($systemConfigEntity->getConfigurationValue() === $shopkey) { - return $this->salesChannelContextFactory->create( + $salesChannelContext = $this->salesChannelContextFactory->create( $currentContext->getToken(), $systemConfigEntity->getSalesChannelId(), [ @@ -51,10 +53,11 @@ public function getSalesChannelContext( SalesChannelContextService::CUSTOMER_ID => $customerId ] ); + $salesChannelContext->getSalesChannel()->setLanguageId($salesChannelContext->getLanguageId()); } } - return null; + return $salesChannelContext; } /** diff --git a/src/Struct/Config.php b/src/Struct/Config.php index d263e9c9..ce94ec26 100644 --- a/src/Struct/Config.php +++ b/src/Struct/Config.php @@ -154,7 +154,9 @@ public function initializeBySalesChannel(SalesChannelContext $salesChannelContex { $salesChannel = $salesChannelContext->getSalesChannel(); $salesChannelId = $salesChannel->getId(); - $languageId = $salesChannel->getLanguageId(); + if (!$languageId = $salesChannelContext->getLanguageId()) { + $languageId = $salesChannel->getId(); + } $this->active = $this->getConfig($salesChannelId, $languageId, 'FinSearch.config.active', false); $this->shopkey = $this->getConfig($salesChannelId, $languageId, 'FinSearch.config.shopkey');