Skip to content

Commit ecd98b9

Browse files
authored
feat(storefront): STRF-8948 Fix Sort By on Search Page (#1971)
1 parent 00d3bd4 commit ecd98b9

File tree

4 files changed

+6
-34
lines changed

4 files changed

+6
-34
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Cornerstone - Image Zoom Does Not Work on Internet Explorer. [#1923](https://github.com/bigcommerce/cornerstone/pull/1923)
2828
- Fixed input placeholder color contrast according to AA standard. [#1933](https://github.com/bigcommerce/cornerstone/pull/1933)
2929
- Bump stencil utils to 6.8.0. [#1945](https://github.com/bigcommerce/cornerstone/pull/1945)
30+
- Bump stencil utils to 6.8.1. and removed changes from #1910 [#1945](https://github.com/bigcommerce/cornerstone/pull/1945)
3031

3132
## 5.0.0 (12-14-2020)
3233
- Parse HTML entities in jsContext. [#1917](https://github.com/bigcommerce/cornerstone/pull/1917)

assets/js/theme/search.js

-29
Original file line numberDiff line numberDiff line change
@@ -132,37 +132,8 @@ export default class Search extends CatalogPage {
132132
$($tabsCollection.get(nextTabIdx)).focus().trigger('click');
133133
}
134134

135-
getUrlParameter(queryParam) {
136-
const regex = new RegExp(`[\\?&]${queryParam}=([^&#]*)`);
137-
const results = regex.exec(window.location.search);
138-
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
139-
}
140-
141-
setupSortByQuerySearchParam() {
142-
const searchQuery = this.getUrlParameter('search_query');
143-
144-
if (searchQuery.length === 0) return;
145-
146-
const $baseInput = $('<input/>').attr('type', 'hidden');
147-
148-
$('[data-sort-by]').each((idx, form) => {
149-
const $form = $(form);
150-
$form.append(
151-
$baseInput.clone().attr({
152-
name: 'search_query',
153-
value: searchQuery,
154-
}),
155-
$baseInput.clone().attr({
156-
name: 'section',
157-
value: $form.data('sort-by'),
158-
}),
159-
);
160-
});
161-
}
162-
163135
onReady() {
164136
compareProducts(this.context.urls);
165-
this.setupSortByQuerySearchParam();
166137

167138
const $searchForm = $('[data-advanced-search-form]');
168139
const $categoryTreeContainer = $searchForm.find('[data-search-category-tree]');

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "BigCommerce",
77
"license": "MIT",
88
"dependencies": {
9-
"@bigcommerce/stencil-utils": "^6.8.0",
9+
"@bigcommerce/stencil-utils": "^6.8.1",
1010
"core-js": "^3.6.5",
1111
"creditcards": "^3.0.1",
1212
"easyzoom": "^2.5.3",

0 commit comments

Comments
 (0)