SearchSpring.Catalog.init() function and options
SearchSpring.Catalog.init()
For AJAX Catalog users, the SearchSpring.Catalog.init() function initializes SearchSpring AJAX Catalog component and loads SearchSpring on your page.
Options
- leaveInitialResults
- facets
- results
- result_layout
- results_per_page
- layout
- loadCSS
- filters
- backgroundFilters
- maxFacets
- maxFacetsHardLimit
- maxFacetOptions
- sortText
- sortType
- filterText
- previousText
- scrollType
- scrollTo
- compareText
- backgroundSortField
- backgroundSortDir
- summaryText
- showSummary
- subSearchText
- showSubSearch
- forwardSingle
- afterResultsChange
- filterData
leaveInitialResults
Default: false
If set to true SearchSpring will not replace the HTML in your results container until a faceting action is made.
leaveInitialResults: true
facets
Default: '.searchspring-facets_container'
The CSS selector of the HTML tag containing the facet navigation.
facets: '#leftNav'
results
Default: '.searchspring-results_container'
The CSS selector of the HTML tag containing the results.
results: '.resultsTable tr td.results'
result_layout
Default: 'grid'
The default layout to display (e.g. 'grid', 'list').
result_layout: 'list'
results_per_page
Default: 30
The default number of results to display per page of results.
results_per_page: 12
layout
Default: 'left'
The default layout of the facet navigation (e.g. 'top', 'left').
layout: 'top'
loadCSS
Default: true
Determines whether the AJAX Catalog should load it's CSS files. Setting this to false will allow you to include CSS files yourself to host them locally.
loadCSS: false
filters
Default: {}
The default faceting values. This should be a javascript object with property names being SearchSpring fields and the property values being arrays of values you wish to facet upon. These fields are shown in the display.
filters: {
department: ['Mens'],
color: ['Blue', 'Green']
}
backgroundFilters
Default: {}
The default hidden faceting values. This should be a javascript object with property names being SearchSpring fields and the property values being arrays of values you wish to facet upon. These fields are NOT shown in the display.
backgroundFilters: {
department: ['Mens'],
color: ['Blue', 'Green']
}
maxFacets
Default: 100
The maximum number of facets to show on a results page. This is useful if you have several different faceted fields.
maxFacets: 5
maxFacetsHardLimit
Default: true
Determines whether active facets count against the maximum number of facets determined by the maxFacets option.
maxFacets: false
maxFacetOptions
Default: 100
The maximum number of facet options to show for a single facet. Facet options beyond the maximum will only be shown if the customer clicks a link to show/hide remaining facet options.sortText
Default: 'Sorting: '
The text to display next to your sorting options.
sortText: 'Sort By: '
sortType
Default: 'link'
How to display your sorting options (e.g. link, dropdown).
sortType: 'dropdown'
filterText
Default: 'Filter Your Results'
The text to display above the facet navigation.
filterText: 'Refine Your Search'
previousText
Default: 'prev'
The text to display in the previous page button.
filterText: 'Previous'
scrollType
Default: 'jump'
Determines effect to use when scrolling to top of page after actions on the search results (e.g. 'jump', 'scroll', 'none').
scrollType: 'scroll'
scrollTo
Default: '#searchspring-main'
Selector for element to scroll to after action son the search results.
scrollTo: 'body'
compareText
Default: 'Compare'
The text to display in the compare box.
filterText: 'Compare Products'
backgroundSortField
Default: ''
Determines default sorting field.
backgroundSortField: 'price'
backgroundSortDir
Default: 'asc'
Determines default sorting direction
backgroundSortDir: 'desc'
summaryText
Default: 'Your Refinements'
The heading for the facet summary display.
summaryText: 'Current Filters'
showSummary
Default: false
Toggles display of facet summary above facet options.
showSummary: true
subSearchText
Default: 'Search Within Results'
The heading for the subsearch display.
subSearchText: 'Subsearch:'
showSubSearch
Default: false
Toggles display of subsearch filter above facet options
showSubSearch: true
forwardSingle
Default: true
Toggles whether or not SearchSpring will automatically redirect to the product page for searches that only yield a single result.
forwardSingle: false
afterResultsChange
Default: null
Callback function that fires after results have been updated, can be used to update UI.
afterResultsChange: function() { $('.pagination').hide(); }
filterData
Default: null
Callback function that fires before UI has been drawn, can be used to filter results or facets.
filterData: function(data) { console.debug(data); }
Complete Example
SearchSpring.Catalog.init({
leaveInitialResults : true,
facets : '.leftNav',
results : '#results',
result_layout: 'list',
results_per_page : 12,
layout: 'top',
loadCSS: false,
filters: {
color: ['Blue']
},
backgroundFilters: {
category: ['Shirt', 'Shoes'],
department: ['Mens']
},
maxFacets: 5,
maxFacetOptions: 10,
sortText: 'Sort By ',
sortType: 'dropdown',
filterText: 'Refine Search Results',
previousText: 'Previous',
scrollType: 'scroll',
scrollTo: 'body',
backgroundSortField: 'price',
backgroundSortDir: 'desc',
compareText: 'Compare Items',
summaryText: 'Current Filters',
showSummary: true,
subSearchText: 'Subsearch:',
showSubSearch: true,
forwardSingle: false,
afterResultsChange: function() { $('.pagination').hide(); },
filterData: function(data) { console.debug(data); }
});