cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

pre selected value in advance search field in backoffice

0 Kudos
1,083

bo.pngbo1.pngHi expert,

in Backoffice advance search , i need to set the value as pre selected for catalog version lets say - Staged and folder as image. how can i achieve this ?

Thanks Rohit

Accepted Solutions (0)

Answers (2)

Answers (2)

pavan_joshi1
Participant
0 Kudos

Answer :
You can write a filter/ adapter as below.
Code is not to the point for classes/ models, please change based on Hybris version.

Hope it solves your problem.

class YourClass extends AbstractInitAdvancedSearchAdapter {
public void addSearchDataConditions(final AdvancedSearchData searchData)
{
 final FieldType fieldType = new FieldType();
 fieldType.setDisabled(Boolean.FALSE);
 fieldType.setSelected(Boolean.TRUE);
 fieldType.setName("catalog");

 // multi conditions
 searchData.addCondition(fieldType, ValueComparisonOperator.EQUAL, CatalogVersion.Staged);
 searchData.addCondition(fieldType, ValueComparisonOperator.UNEQUAL, OrderStatus.Online);
}
}
0 Kudos

Hi Rohit,

I am not sure if this is possible. Probably it is, but I will be in glad if someone else can answer the question too. I had the same requirement in In my previous project. Some of the search attributes in the advanced-search to be preselected. What you will find as solution below is the one that we provided to our customer. It is not exactly what you are looking for, but it's very close and easy achievable as configuration. Please find the solution below.

<context merge-by="type" type="Media" component="advanced-search" >
   <advanced-search:advanced-search>
      <advanced-search:field-list>
         <advanced-search:field name="catalogVersion" editor=""  selected="true" >
            <advanced-search:editor-parameter>
               <advanced-search:name>referenceSearchCondition_version_equals</advanced-search:name>
               <advanced-search:value>Staged</advanced-search:value>
            </advanced-search:editor-parameter>
         </advanced-search:field>
         <advanced-search:field name="folder" selected="true" >
            <advanced-search:editor-parameter >
               <advanced-search:name >referenceSearchCondition_path_equals</advanced-search:name>
               <advanced-search:value>images</advanced-search:value>
            </advanced-search:editor-parameter>
         </advanced-search:field>
      </advanced-search:field-list>
   </advanced-search:advanced-search>

</context> 

Actually this will limit the results in the in the searched fields, but I don't know if it's possible to be preselected.

Hope this helps.

P.s Please don't forget to vote for the answer if you find it as reasonable.

Best Regards,