episerver / Foundation

Foundation offers a starting point that is intuitive, well-structured and modular allowing developers to explore CMS, Commerce, Personalization, Search and Navigation, Data Platform and Experimentation.
https://docs.developers.optimizely.com/digital-experience-platform/docs/optimizely-foundation-demo-sites
Apache License 2.0
132 stars 137 forks source link

Sort By Price wont sort #732

Closed clintcfavor closed 3 years ago

clintcfavor commented 3 years ago

Describe the bug When trying to sort the category by price, the price doesn't sort in correct order.

To Reproduce Steps to reproduce the behavior:

  1. Go to any category
  2. Click on 'Sort By' Price
  3. Notice the price isn't sorted correctly in the screenshot. Note the $280 can be seen between the prices $400 ang $540

Expected behavior Prices should be sorted ($280, $400, $540, etc.)

Screenshots image

Desktop (please complete the following information):

Additional context Attaching a screenshot of an exception in the Immediate Window image

ngocnguyen-epi commented 3 years ago

@clintcfavor Please get the branch and let me know if it works https://github.com/episerver/Foundation/tree/bugfix/732-sort-by-price-wont-sort

mllrdev-joanne-ferrolino commented 3 years ago

We have tested the fix on our local environment and these are our findings when testing the sort by price:

  1. The fix doesn't work when using the current find index of this fix () but works correctly using our index: .

  2. When using episerverab_index55794, it sorted products by price correctly only on some subcategories., i.e., Men > Sweater, but didn't work on the main categories and other subcategories. After some time navigating the site, the sort by price doesn't work correctly again, as seen in this screenshot below:

image

When this happens, we clear and reindex for it to work again as expected.

Here is an error log when products don't sort or when there are no products displayed on the category pages:

System.Net.WebException: The remote name could not be resolved: 'emea13.find.episerver.net' at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at EPiServer.Find.Connection.JsonRequest.WriteBody(String body) at EPiServer.Find.Api.SearchCommand1.Execute() at EPiServer.Find.Client.Search[TResult](SearchRequestBody requestBody, Action1 commandAction) at EPiServer.Find.SearchExtensions.GetProjectedResult[TResult](ISearch1 search, SearchContext context) at EPiServer.Find.SearchExtensions.GetResult[TResult](ISearch1 search) at EPiServer.Find.Cms.SearchRequestExtensions.GetContentResult[TContentData](ITypeSearch1 search, Int32 cacheForSeconds, Boolean cacheForEditorsAndAdmins) at Foundation.Features.Search.SearchService.GetSearchResults(IContent currentContent, FilterOptionViewModel filterOptions, String selectedfacets, IEnumerable1 filters, Int32 catalogId) in D:\Test Projects\Foundation\Src\Foundation\Features\Search\SearchService.cs:line 584 at Foundation.Features.Search.SearchService.Search(IContent currentContent, FilterOptionViewModel filterOptions, String selectedFacets, Int32 catalogId) in D:\Test Projects\Foundation\Src\Foundation\Features\Search\SearchService.cs:line 119 at Foundation.Features.Search.SearchViewModelFactory.Create[TContent](TContent currentContent, String selectedFacets, Int32 catalogId, FilterOptionViewModel filterOption) in D:\Test Projects\Foundation\Src\Foundation\Features\Search\SearchViewModelFactory.cs:line 72 at Foundation.Features.Search.Category.CategoryController.<Index>d__2.MoveNext() in D:\Test Projects\Foundation\Src\Foundation\Features\Search\Category\CategoryController.cs:line 38 --- End of stack trace from previous location where exception was thrown ---

With these findings, the sorting works best when we use our index but we have to clear and reindex when the sorting doesn't work again. Please check if this has something to do with our index.

ngocnguyen-epi commented 3 years ago

@mllrdev-joanne-ferrolino Please update the Find index to your own credentials and retest the site. The default index () is public, everyone can clear/reindex anytime, the data will not be correct sometimes.