Skip to content

Commit 34ad295

Browse files
author
Anna Bukatar
committed
MDVA-214: Port down MAGETWO-49004
- Fixed duplicated SQL queries
1 parent 056fce7 commit 34ad295

File tree

1 file changed

+11
-7
lines changed
  • app/code/Magento/Catalog/Model/Layer/Filter/DataProvider

1 file changed

+11
-7
lines changed

app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Category.php

100644100755
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,17 @@ public function getCategory()
112112
/** @var CategoryModel|null $category */
113113
$category = null;
114114
if ($this->categoryId !== null) {
115-
$category = $this->categoryFactory->create()
116-
->setStoreId(
117-
$this->getLayer()
118-
->getCurrentStore()
119-
->getId()
120-
)
121-
->load($this->categoryId);
115+
if ($this->coreRegistry->registry('current_category')->getId() == $this->categoryId) {
116+
$category = $this->coreRegistry->registry('current_category');
117+
} else {
118+
$category = $this->categoryFactory->create()
119+
->setStoreId(
120+
$this->getLayer()
121+
->getCurrentStore()
122+
->getId()
123+
)
124+
->load($this->categoryId);
125+
}
122126
}
123127

124128
if ($category === null || !$category->getId()) {

0 commit comments

Comments
 (0)