question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

soryBySelector is not sorting entries on the Front end.

See original GitHub issue

I have setup a replica indice in Algolia dashboard as per what has been written on the algolia documentation.

screen shot 2018-06-20 at 10 04 54

On seeing the filter/sort in the frontend I go to click filter on Price high or price low and nothing happens, I have even checked the console and nothing is happening on the algolia api calls.

screen shot 2018-06-20 at 10 06 46

https://viaduct.frb.io/products/bedroom-furniture

What I would expect to see is the items filtering

  • OS: mac
  • Browser chrome/safari/firefox
  • Version latest

Here is my code for the functionality:

		var searchProducts = instantsearch({
		  // Replace with your own values
		  appId: 'NHF40KMICV',
		  apiKey: '91615faeab7c9c7e761f22279d5d1513', // search only API key, no ADMIN key
		  indexName: 'www.viaduct.co.uk_allProducts',
		  urlSync: false,
		  searchParameters: {
    		hitsPerPage: 500
  		  }
		});

	// types.level2.title

	if( $('#types').length ){
		searchProducts.addWidget(
		  instantsearch.widgets.refinementList({
		    container: '#types',
		    attributeName: 'types.level2.title',
		    operator: 'or'
		  })
		);
	}
	if( $('#selectedFilters').length ){
		searchProducts.addWidget(
		  instantsearch.widgets.currentRefinedValues({
		    container: '#selectedFilters',
		    onlyListedAttributes: true,
			attributes: [{name: 'types', label: 'Types'},{name: 'types.level2.title', label: 'Type'},{name: 'productPrice', label: 'Price'},{name: 'material', label: 'Material'}],
		    clearAll: 'after'
		  })
		);
	}
	if( $('#price-refinement').length ){
		searchProducts.addWidget(
			instantsearch.widgets.sortBySelector({
			    container: '#price-refinement',
			    indices: [
			    	{ name: 'www.viaduct.co.uk_allProducts', label: 'Price' },
			      	{name: 'products_by_price_low', label: 'Price lowest'},
			      	{name: 'products_by_price_high', label: 'Price highest'}
			    ],
			    label: 'Price'
			  })
		);
	}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Haroenvcommented, Jun 20, 2018

I can see requests being done and the index name being changed, so this should work. Is the sort by different in the dashboard if you go to the different indices?

0reactions
bobylitocommented, Jul 18, 2018

Closing this for now. If there are any updates, feel free to open a new issue. Thanks for your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

View sorting isn't working
Check sorting in Gravity Forms: GravityView relies on Gravity Forms to fetch and sort the entries displayed on the front end of your...
Read more >
Time Entries Submitted From Juris Suite not Sorting Correctly ...
This is a known issue in Juris. There is a workaround, however: Go to JurisSuite > Firm Settings. Click My Time and scroll...
Read more >
Could you please help us display the sort order on the front end
I was unable to display the sort order on the front end in the same way that it looks using your plugin. you...
Read more >
Array sorting in Front-end or Back-end [closed] - Stack Overflow
Agree. The backend should return array of objects that can be sorted by different properties such as created_at , order , title etc......
Read more >
Sort entries in a category or entries field?
Both - when I click on the Category on the front end I want to load the products in that category - but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found