Expand my Community achievements bar.

Issue Hybris Importer - "Sling:resourceType" prop not getting generated

Avatar

Level 3

Hi All,

While importing the product content from Hybris(http://localhost:4502/etc/importers/hybris.html) all the properties are generating properly except property “sling:resourceType” . It is happening for Product node and Variant Node. The image node is able to add “sling:resourceType” property. Is there any know issue on this? if so, what would be the solution. This is the custom Hybris Importer implementation we are developing for our project.

For the Code below I am able to generate properties cq:commerceType, myvariant as well jcr:lastModified but not sling:resourceType property. I tried pointing to OOTB importer code as well. But not able to generate sling:resourceType property.

 

protected Node createVariant(Node parentProduct, String name) throws RepositoryException {

              Node variant = JcrUtil.createUniqueNode(parentProduct, name, "nt:unstructured", parentProduct.getSession());

              variant.setProperty("cq:commerceType", "variant");

              variant.setProperty("myvariant", "myvariantmyvariantmyvariantmyvariantmyvariant");

              variant.setProperty("sling:resourceType", "commerce/components/product1");

              variant.setProperty("jcr:lastModified", Calendar.getInstance());

 

protected Node createProduct(String path, Session session) throws RepositoryException {

 

Node product = JcrUtil.createUniqueNode(parent, Text.getName(path), "nt:unstructured", session);

              product.setProperty("cq:commerceType", "product");

              product.setProperty("myproduct", "myproductmyproductmyproductmyproductmyproductmyproductmyproduct");

              product.setProperty("sling:resourceType", "commerce/components/product2");

              product.setProperty("jcr:lastModified", Calendar.getInstance());

2 Replies

Avatar

Level 2

Could you try (as a test) to set sling:resourceSuperType instead?