Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use language from sales channel when fetching products #25

Open
phizab opened this issue Oct 17, 2024 · 1 comment
Open

Use language from sales channel when fetching products #25

phizab opened this issue Oct 17, 2024 · 1 comment

Comments

@phizab
Copy link
Collaborator

phizab commented Oct 17, 2024

In following place the language from system config is used:

$language = $this->config->getLanguage($context->getSalesChannelId());

But what if a sales channel has multiple languages configured? Wouldn't it be better to use the language from current sales channel instead of a config value? Such as:

$criteria = new Criteria([$context->getLanguageId()]);
$criteria->addAssociation('locale');

/** @var LanguageEntity $languageEntity */
$languageEntity = $this->languageRepository->search($criteria, $context)->first();

$language = substr($languageEntity->getLocale()->getCode(), 0, 2);

In $language we got something like 'de' or 'en'. Singe the config value is not used in any other place, it then can be removed.

I can make a pull request, if you agree with this.

@BenjaminJoergerMakaira
Copy link
Contributor

We think using the language settings from the sales channel as you suggested is correct.
However, at the moment, it looks like the module supports only ONE language, the one configured in the module settings.

The correct request would be: "Support multilanguage based on the configured languages in the sales channel."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants