Skip to content

Commit

Permalink
Merge pull request #410 from findologic/SW-810_adapt_saleschanel_lang…
Browse files Browse the repository at this point in the history
…uage_logic

SW-810 Adapt sales channel logic for language id v6
  • Loading branch information
Bibarella authored Sep 30, 2024
2 parents e2c6e0d + 9d4f8a6 commit f1def06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Export/Services/SalesChannelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ 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(),
[
SalesChannelContextService::LANGUAGE_ID => $systemConfigEntity->getLanguageId(),
SalesChannelContextService::CUSTOMER_ID => $customerId
]
);
$salesChannelContext->getSalesChannel()->setLanguageId($salesChannelContext->getLanguageId());
}
}

return null;
return $salesChannelContext;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Struct/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit f1def06

Please sign in to comment.