Skip to content

Commit 3c839cc

Browse files
committed
ACP2E-322:'Move out of stock to the bottom' automating sorting is not updated when product's stock changes
1 parent 603ed51 commit 3c839cc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/code/Magento/CatalogInventory/Model/ResourceModel/StockStatusFilter.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ class StockStatusFilter implements StockStatusFilterInterface
2121
private const TABLE_NAME = 'cataloginventory_stock_status';
2222

2323
/**
24-
* @var bool|null
24+
* Storefront search result applier flag
25+
*
26+
* @var bool
2527
*/
26-
private ?bool $searchResultApplier = null;
28+
private ?bool $searchResultApplier = false;
2729

2830
/**
2931
* @var ResourceConnection
@@ -62,7 +64,7 @@ public function setSearchResultApplier(bool $status): void
6264
*
6365
* @return bool
6466
*/
65-
public function getSearchResultApplier() : bool
67+
public function hasSearchResultApplier() : bool
6668
{
6769
return $this->searchResultApplier;
6870
}
@@ -93,7 +95,7 @@ public function execute(
9395
implode(' AND ', $joinCondition),
9496
[]
9597
);
96-
if (!$this->getSearchResultApplier()) {
98+
if (!$this->hasSearchResultApplier()) {
9799
$select->where("{$stockStatusTableAlias}.stock_status = ?", StockStatusInterface::STATUS_IN_STOCK);
98100
}
99101

app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Resolve specific attributes for search criteria.
20+
*
21+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2022
*/
2123
class SearchResultApplier implements SearchResultApplierInterface
2224
{

0 commit comments

Comments
 (0)