Issue with Localized Fields in child objects for inherited attributes #17706
-
Hi, I've encountered an issue with Localized Fields in hierarchical objects (parent-child). For example, if a parent product has an attribute like a localized name or description, and it is the same for all child objects, calling getName('en') or getDescription('en') on a child object returns null. However, accessing the same attribute from the parent works as expected. This requires manual logic to check if the attribute is null in the child and then fetch it from the parent if necessary. If the child has a different value for the localized field, the issue does not occur, and calling getName('en') or similar returns the expected value. Is this the expected behavior for Localized Fields, or is there a way to make these fields automatically inherit from the parent if they are not set in the child object? Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
No it's not expected, except when you are in Backend-UI context. In what context are you in? Where do you call that code? |
Beta Was this translation helpful? Give feedback.
When you are in a /admin route, you are in admin context afaik. And then Pimcore sets
AbstractObject::setGetInheritedValues(false);
.You need to set it to
true
again...