InheritanceValueMap is not working for node | Community
Skip to main content
AEM__Campaign__
December 4, 2017
Question

InheritanceValueMap is not working for node

  • December 4, 2017
  • 1 reply
  • 966 views

Hi,

I have some product variation node under /etc/commerce/products and resource type of node is

sling:resourceType

String

commerce/components/product

I am trying to get value from these nodes using InheritanceValueMap but its not working while Parent have the property which i am accessing.

Parent Node

Child Node

Here is my code

            final Resource prodRes = resourceResolver.getResource("/etc/commerce/products/XXXX/XX/XX/XX/BES870CBXL/BES870CBXL");

            final InheritanceValueMap inVM = new HierarchyNodeInheritanceValueMap(prodRes);

            final String bcode = inVM.getInherited("price", "");

Please provide suggestion if i am doing anything wrong.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

edubey
Level 10
December 4, 2017

HierarchyNodeInheritanceValueMap does not return the inherited value from parent node....but from the parent page. So it won't work in your case.

If you have a structure like

Parent - /content/pageA/jcr:content - key = value

Child - /content/pageA/pageB/jcr:content

In this case, parent key will be inherited on the child page.

You can also find the explanation in documentation: https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html 

thanks