Config ignored/not handled correctly in akeneo category import


#1

We noticed that the categories are only imported for current LOCALE (not current store and not using the akeneo config). I.e If we run category import with this setting:

'locales' => [
    // first entry is default
    'en' => 'en_US',
    'de' => 'de_DE',
], 

categories won’t be visible in the admin, but if we run importer again with:

'locales' => [
    // first entry is default
    'de' => 'de_DE',
    'en' => 'en_US',
], 

they will be visiblein zed.de.suite.local

Why is importer ignoring official config

$config[AkeneoPimMiddlewareConnectorConstants::LOCALES_FOR_IMPORT] = [
  'de_DE',
  'en_US',
];

?


#2

Hi Jan!

It looks to be not related to the import itself, the default entry is used by Zed to show categories titles on the categories page. It seems, that you are having no values for en_US in Akeneo, but you are trying to show them there in Zed. Therefore no values are not imported and therefore Zed is not showing them.

Could you please try setting en_US values for some categories in Akeneo and try to import them? They should appear. This will confirm, that it comes not from the import, but from viewing the set. Alternatively, please examine the database and check, that spy_category table is filled in by the import process.

$config[AkeneoPimMiddlewareConnectorConstants::LOCALES_FOR_IMPORT]

is used to exclude some locales in the import and by default not applied for categories as there is no much data, but if you would like to activate it, you can extend the translators in the similar way it is done for product or like in LabelsToLocalizedAttributeNames used in DefaultCategoryImportDictionary.

We hope this helps.


#3

It seems, that you are having no values for en_US in Akeneo, but you are trying to show them there in Zed.

This is correct, but grid doesn’t show records at all, it should only show the rows without names in the name column the same way it does it with products. Does that mean spryker grids are inconsistent in behavior by design?

Therefore no values are not imported and therefore Zed is not showing them.

This is not correct. I can see the categories in spy_category table.

Could you please try setting en_US values for some categories in Akeneo and try to import them?

I cannot control akeneo data so I cannot just add new translation to it. We’re just using the API to get the data into Spryker. I cannot force both owners to use the same locale as store main locale so this shouldn’t be a solution to the issue.

Alternatively, please examine the database and check, that spy_category table is filled in by the import process.

As mentioned above, the data is in spy_category table, just not showing up on grid because translation for main locale wasn’t imported / doesn’t exist in akeneo (data source).

AkeneoPimMiddlewareConnectorConstants::LOCALES_FOR_IMPORT] is used to exclude some locales in the import

This is simply unintuitive. IF this is EXCLUDES locales, it should indicate so in the name, like “EXCLUDE_LOCALES_FROM_IMPORT”.

However, maybe you meant it’s locales WHITELIST and whatever is NOT on the list is excluded? In that case, this doesn’t make sense because the store already has defined available locales (in stores.php) what functionality do we get by duplicating the config and making it global (non store-specific)?


#4

It shows the default locale by default, when there are no values for the default locale it will not show entries. You can easily test it if adding e.g. pl_PL as a default locale.

To solve this, you can duplicate translation for the default locale also, then Zed will have translations and will show the tree. There is an example translator function AddMissingLocales in Akeneo integration, that adds empty values for missing locales, you might need your own version of it filling in missing locales with values you want.

This is simply unintuitive. IF this is EXCLUDES locales, it should indicate so in the name, like “EXCLUDE_LOCALES_FROM_IMPORT”.

Sorry for confusion in wording. For example, Akeneo can have 5 locales, if AkeneoPimMiddlewareConnectorConstants::LOCALES_FOR_IMPORT] defines 2, only these 2 will be imported. So it is not to exclude these, but exclude all others existing in Akeneo except these specified in the setting.