From 045b95c50bce57f67264337865b63af4dfb8782d Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Wed, 10 Jan 2018 11:54:21 +0200
Subject: [PATCH] magento/magento2#12860: Sort by Product Name doesn't work
with Ancor and available filters.
(cherry picked from commit e5b030a)
---
.../Model/ResourceModel/Fulltext/Collection.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
index 4449dc2a6596f..903e5f59c9855 100644
--- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
@@ -350,15 +350,21 @@ protected function _renderFiltersBefore()
'search_result.'. TemporaryStorage::FIELD_SCORE . ' ' . $this->relevanceOrderDirection
);
}
+ return parent::_renderFiltersBefore();
+ }
+ /**
+ * @inheritdoc
+ */
+ protected function _beforeLoad()
+ {
/*
* This order is required to force search results be the same
* for the same requests and products with the same relevance
* NOTE: this does not replace existing orders but ADDs one more
*/
$this->setOrder('entity_id');
-
- return parent::_renderFiltersBefore();
+ return parent::_beforeLoad();
}
/**