cancel
Showing results for 
Search instead for 
Did you mean: 

how to add an attribute of a different type in advanced-search in backoffice?

AlexAndrew
Discoverer
308

Is it possible that in backoffice to add a new field in the customerReview advanced-search, to search for customer reviews by the product code, ootb i can search by the product itself: 

<context merge-by="type" parent="GenericItem" type="CustomerReview" component="advanced-search">
   <advanced-search:advanced-search xmlns:advancedsearch="http://www.hybris.com/cockpitng/config/advancedsearch">
        <advanced-search:field-list>
<advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="product" selected="true"/>
</advanced-search:field-list>
 </advanced-search:advanced-search>
    </context>

 I tried this but it didn't work: 

<context merge-by="type" type="CustomerReview" component="advanced-search">
    <advanced-search:advanced-search>
        <advanced-search:field-list>
            <advanced-search:field name="product.code" selected="true"/>
</advanced-search:field-list>
   </advanced-search:advanced-search>
</context>

 

View Entire Topic
Harish_Vatsa
Active Contributor

Hi @AlexAndrew 

Not sure which version of hybris you are using. But the ootb "customerreview-backoffice-config.xml" file already have the required code in place to show Product in Customer Review in Advance Search along with other fields.

  <context merge-by="type" parent="GenericItem" type="CustomerReview" component="advanced-search">
        <advanced-search:advanced-search xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch">
            <advanced-search:field-list>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="alias" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="approvalStatus" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="blocked" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="comment" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="headline" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="language" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="product" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="rating" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="user" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="comments" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="creationtime" selected="true"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="itemtype" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="modifiedtime" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" name="owner" selected="false"/>
                <advanced-search:field xmlns="http://www.hybris.com/cockpitng/config/advancedsearch" editor="com.hybris.cockpitng.editor.defaultlong" name="pk" selected="false"/>
            </advanced-search:field-list>
        </advanced-search:advanced-search>
    </context>


Just try to reset your backoffice in the orchestration mode by login into backoffice as Admin
-> pressing F4 -> reset everything  -> F4

You can also see the cockpit-config.xml file in the orchestration mode to see if the changes are there or not in the xml file when your server is running.

Harish_Vatsa_0-1730716916550.png

 

AlexAndrew
Discoverer
0 Kudos
hello @Harish_Vatsa! i have the ootb "customerreview-backoffice-config.xml" file. but I was wondering if it is possible to do an advanced search base on the attribute code of the item type Product.
Harish_Vatsa
Active Contributor

Hello @Alex,
In this case you need to have Product Code as field in your Customer Review Model. 

Reason being - Advance Search work on the type of the attribute which is there in the main model. In your case customerReview is the main model, hence the  product attribute which is of type productModel can only be used.