7

Is there any way to get the results of Broker Query in a sorted order based on the metadata of keyword, keyword itself a metafield of the component.

We have 3 types of products Gold, Silver, Platinum and we have 20 products created as components in the cms based on these 3 types. For each type we have created a keyword and associate the keyword as metadata of component.

Now we need to fetch the components using broker query in sorted order based on product type. If we define the sort order(numeric 1, 2 , 3) in metadata field of each keyword (using metadata schema) can we make a broker query to fetch sorted component list ; sorted by product type.

Thought is if sort order needs to be changed in future, then just needs to change the metafield value of keywords.

1 Answer 1

4

I don't think this can be done in one query and then have the desired end result straight away, as keyword metadata is stored separately from component (meta)data.

What you can do is:

  1. Fetch components based on the three keywords.
  2. Fetch the actual keywords
  3. Write logic to order the three sets of components based on metadata of the keywords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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