on 2022 Feb 08 12:36 PM
Dear Export,
I want to add a new solr sort name - "Customer Price Asc and Customer Price Dsc" on Product Listing Page and Search. We already have OOTB box sort like, Name Asc, Name Dsc, Price Asc and Price Dsc in sort drop down, but want this another sort on newly added attribute called "Customer Price".
On slor data is indexed in below form.
"customerPrices_eur_string_mv":["1294415:45.0"]
I followed the steps mentioned on below link in sap help and creaed provider - customPriceAttributeSortProvider
<bean id="customPriceAttributeSortProvider"
class="de.hybris.platform.solrfacetsearch.config.impl.DefaultFacetSortProvider">
<property name="comparator" ref="customPriceFacetAttributeComparator"/>
</bean>
<bean id="customPriceFacetAttributeComparator"
class="de.hybris.platform.acceleratorservices.search.comparators.FacetValueNameComparator">
<property name="comparator" ref="customPriceAttributeComparator"/>
</bean>
<bean id="customPriceAttributeComparator"
class="com.gardena.core.search.comparator.CustomPriceAttributeComparator">
</bean>
Below is the impexes for customer price attribute and solr sort
INSERT_UPDATE SolrIndexedProperty ;solrIndexedType(identifier)[unique=true];name[unique=true];type(code);customFacetSortProvider;facetSort(code)
;$solrIndexedType;customerPrices ;string;customPriceAttributeSortProvider ;Custom
# Define the available sorts
INSERT_UPDATE SolrSort;&sortRefID;indexedType(identifier)[unique=true];code[unique=true];useBoost
;sortRef5;$solrIndexedType;customerPrices-asc;false
;sortRef6;$solrIndexedType;customerPrices-desc;fal
# Define the sort fields
INSERT_UPDATE SolrSortField;sort(indexedType(identifier),code)[unique=true];fieldName[unique=true];ascending[unique=true]
;$solrIndexedType:customerPrices-asc;customerPrices;true
;$solrIndexedType:customerPrices-desc;customerPrices;false
After running the above impex i can see the new sort field added in drop down but its not returning the expected result, also when i put the debug
point to class - CustomPriceAttributeComparator and could not see the call to this class and the time of indexing or when we choose the customer price sort using drop down.
Any help will be appreciated,
Thanks in advance
Kundan Kumar
Did you find a solution?, I have the same problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.