Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Created August 12, 2013 17:54
Show Gist options
  • Save steveosoule/6213285 to your computer and use it in GitHub Desktop.
Save steveosoule/6213285 to your computer and use it in GitHub Desktop.
Search Spring Catalog Init Function Example
/* From https://searchspring.zendesk.com/entries/23536266-SearchSpring-Catalog-init-function-and-options#facetOptionCallback */
SearchSpring.Catalog.init({
afterResultsChange: function() { $('.pagination').hide(); },
backgroundFilters: {
category: ['Shirt', 'Shoes'],
department: ['Mens']
},
backgroundSortDir: 'desc',
backgroundSortField: 'price',
breadcrumbSeparator: ' » ',
collapseAll: false,
collapsedText: 'Show More Options',
compareCallback: function() {
console.log('Compare dialog opened');
},
compareText: 'Compare Items',
expandedText: 'Show Less Options',
facetOptionCallback: function(value_option, facet, value) {
console.log(value_option, facet, value);
},
facets : '.leftNav',
facetTitleCallback: function(facet_container, facet_title, facet) {
console.log(facet_container, facet_title, facet);
},
filterData: function(data) { console.debug(data); },
filterPrefix: 'Option: ',
filters: {
color: ['Blue']
},
filterText: 'Refine Search Results',
forwardSingle: false,
historyText: 'Recent Searches',
layout: 'top',
leaveInitialResults : true,
loadCSS: false,
maxFacetOptions: 10,
maxFacets: 5,
modifyRequest: function(request) {
console.log(request);
request.page = '2';
return request;
},
nextText: 'Next',
previousText: 'Previous',
resetText: 'Reset',
result_layout: 'list',
results : '#results',
results_per_page: 12,
resultsPerPageType: 'link',
scrollTo: 'body',
scrollType: 'scroll',
showReset: false,
showSearchHistory: true,
showSubSearch: true,
showSummary: true,
sortText: 'Sort By ',
sortType: 'dropdown',
subSearchText: 'Subsearch:',
summaryText: 'Current Filters'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment