Skip to content

Commit 34b6438

Browse files
12468: Sort by Price not working on CatalogSearch Page in Magento 2
1 parent c0b6034 commit 34b6438

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ public function getWidgetOptionsJson(array $customOptions = [])
689689
'limit' => ToolbarModel::LIMIT_PARAM_NAME,
690690
'modeDefault' => $defaultMode,
691691
'directionDefault' => $this->_direction ?: ProductList::DEFAULT_SORT_DIRECTION,
692-
'orderDefault' => $this->_productListHelper->getDefaultSortField(),
692+
'orderDefault' => $this->getOrderField(),
693693
'limitDefault' => $this->_productListHelper->getDefaultLimitPerPageValue($defaultMode),
694694
'url' => $this->getPagerUrl(),
695695
];

app/code/Magento/Catalog/view/frontend/web/js/product/list/toolbar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ define([
7878
);
7979
},
8080

81-
/*eslint-disable no-unused-vars*/
8281
/**
8382
* @param {String} paramName
8483
* @param {*} paramValue
@@ -100,13 +99,14 @@ define([
10099
}
101100
paramData[paramName] = paramValue;
102101

102+
if (paramValue == defaultValue) { //eslint-disable-line eqeqeq
103+
delete paramData[paramName];
104+
}
103105
paramData = $.param(paramData);
104106

105107
location.href = baseUrl + (paramData.length ? '?' + paramData : '');
106108
}
107109
});
108110

109-
/*eslint-enable no-unused-vars*/
110-
111111
return $.mage.productListToolbarForm;
112112
});

0 commit comments

Comments
 (0)