CIF Product Retriever - extendProductQuery for ComplexT | Adobe Higher Education
Skip to main content
ruchim71073425
Level 2
April 19, 2023
Respondido

CIF Product Retriever - extendProductQuery for ComplexT

  • April 19, 2023
  • 3 respostas
  • 957 Visualizações

Hi all,

 

I have to customize the CIF Product List Component to get some extra fields, like description, short description to be displayed.

I haven't been able to find an example of extending the query with complex attributes.

 

So, what I can do with simple fields is:

productsRetriever.extendProductQueryWith(p -> p.metaDescription());

I can't do the same with complex fields, like

productsRetriever.extendProductQueryWith(p -> p.shortDescription());

The error message I get is [{"message":"Field \"short_description\" of type \"ComplexTextValue\" must have a sub selection."

 

Any help will be appreciated here.

 

Thanks

Ruchi

Este tópico foi fechado para respostas.
Melhor resposta por ruchim71073425

So, checked for the OOTB complex field, 

productsRetriever.extendProductQueryWith(p -> p.shortDescription(item -> item.html()) 

3 Respostas

AMANATH_ULLAH
Community Advisor
Community Advisor
April 23, 2023

@ruchim71073425 

You can add complex fields in below mentioned way

 

productRetriever.extendProductQueryWith(p -> p.addCustomObjectField("shortDescription", i -> i.addField("field1").addField("field2").addField("field3"))

 

field1, field2, field3 denotes the sub attributes of the field shortDescription

Amanath Ullah
ruchim71073425
Level 2
May 1, 2023

Thank you. Given short description is not a custom field, will it work?

ruchim71073425
ruchim71073425AutorResposta
Level 2
May 2, 2023

So, checked for the OOTB complex field, 

productsRetriever.extendProductQueryWith(p -> p.shortDescription(item -> item.html())