Loading listItems (text attributes) of product does not respect context language

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
pla
Posts: 14
Joined: 06 Nov 2024, 11:05

Loading listItems (text attributes) of product does not respect context language

Post by pla » 13 May 2026, 11:23

Hi,

I have a problem loading attributes from a product in the given language.

I am using TYPO3 13.4.23 and AIMEOS:
- aimeos/aimeos-core: 2024.10.15
- aimeos/aimeos-typo3: 24.10.5
- aimeos/ai-typo3: 2024.10.5
- aimeos/ai-client-html: 2024.10.7

When I load a product via the product manager and try to load it's text attributes which are stored in multiple languages I expect to get only the translations given in the locale via the context (I made sure it is german => de) on instantiation of the product manager.

But I get ALL available translations.

Here is my code within a decorator on the detail page:

Code: Select all

$productManager = \Aimeos\MShop::create($this->context(), 'product'); // context locale is german => de
$search = $productManager->filter();
$search->add('product.id', '==', $productId);
$product = $productManager->search($search, ['text'])->first();
DebugUtility:debug($product->getListItems('text', 'default', 'attributeTypeCode');
With this code I get ALL languages. Here's an image of a french value but it has a property .languageid = 'de' which seems that there is a check of the language but maybe it's broken or a bug?

list_of_text.png
list_of_text.png (248.93 KiB) Viewed 70 times

Or do I have to add something into my code?

I hope I just oversee something and it is an easy fix.

Thanks and greetings
Pla

pla
Posts: 14
Joined: 06 Nov 2024, 11:05

Re: Loading listItems (text attributes) of product does not respect context language

Post by pla » 14 May 2026, 11:50

I have now built a complete custom initialization based on the AIMEOS source code I figured out so far and still get ALL translations:

Code: Select all

// Getting the AIMEOS TypoScript settings
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
$typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
$typoScript = $configurationManager->getConfiguration(
	ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
);
$typoScript = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScript);
$settings = $typoScript['plugin']['tx_aimeos']['settings'];

// Initializing config, context and locale
$config = Base::config($settings);
$context = Base::context($config);
$localeManager = \Aimeos\MShop::create($context, 'locale');
$locale = $localeManager->bootstrap('default', 'de_DE', 'EUR');

// Apply config and set i18n as well as locale
$config->apply($locale->getSiteItem()->getConfig());
$context->setConfig($config);
$context->setI18n(Base::i18n([$locale->getLanguageId()], $config->get('i18n', [])));
$context->setLocale($locale);

// Load category tree, iterate them and make debug output
$catalogManager = \Aimeos\MShop::create($context, 'catalog');
$categories = $catalogManager->getTree(2, ['text'])->toList();
foreach($categories as $category) {
	DebugUtility::debug($category->getListItems('text', 'default'));
}
die(__FILE__.': '.__LINE__."\n");
And again I get ALL languages of the text attribute listItems as well as this weird property ".languageid" (having the de language as set in locale above) inside the listItem element where all other data starts with "text.XYZ" like in the screenshot of previous post.

Is this intended? How does this work in the e.g. list view of AIMEOS? How does AIMEOS know which language to display for the fields like name, short or long?

At the moment I have to iterate all listItems and check the language by myself

Post Reply