CIF Product Retriever - extendProductQuery for ComplexT | Community
Skip to main content
ruchim71073425
Level 2
April 19, 2023
Solved

CIF Product Retriever - extendProductQuery for ComplexT

  • April 19, 2023
  • 3 replies
  • 957 views

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

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

So, checked for the OOTB complex field, 

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

3 replies

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
ruchim71073425AuthorAccepted solution
Level 2
May 2, 2023

So, checked for the OOTB complex field, 

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