1

I am having following content tree

Sitecore
  • Content
  • myapp

    • home

      -Products

      -Product-1

      • Related-Products-1 (based on Related-Products custom template) – having multi-list field in which we can select products which are related and source would be /Sitecore/Content/myapp/home/Products

      -Product-2

      • Related-Products-2

      -Product-3

      • Related-Products-3

      -Product-4

      • Related-Products-4

To display Related Products items on Product-1 (Product template based item) page, I created the component and in component’s datasource added the xPath query like query:self:://[@@templateid = '{XXXX-XXXX-XXXX}'], so that I will get Product listing but it’s returning the xPath query in datasource attribute like: "dataSource": "query:self:://[@@templateid = '{XXXX-XXXX-XXXX}']"

If, I will assign direct path of item Related-Products, in the component then I am getting the details, with this way in each and every page I have to change the datasource manually and I can’t use __StandardValue of template to assign the Component with datasource, is there any other way to achieve this use case?

2

JSS does not resolve multi-item datasources such as query: expressions.

In JSS you'll want to look at Rendering Contents Resolvers which enable you to precisely control the JSON returned for the fields property on the layout service, or Integrated GraphQL.

  • I have written the custom resolver to get details of items added as Related products and created the object (List<Product Model> which will return field values. In this case, custom resolver will support the personalizationor not, If personalization added in the Hero Image component present at Product-2 item and the Product-2 item details (item data) being fetched via custom code (children) then it can return personalized content by anyway or need to access the Hero image rendering for personalize content? – Amit Kumar May 28 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.