Skip to content

Commit d614317

Browse files
author
Anna Bukatar
committed
Merge branch 'MDVA-214' into 2.0.5_backlog
2 parents 4ff54c2 + 4948d22 commit d614317

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

app/code/Magento/Catalog/Controller/Category/View.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ public function execute()
172172
if ($settings->getPageLayout()) {
173173
$page->getConfig()->setPageLayout($settings->getPageLayout());
174174
}
175+
176+
$hasChildren = $category->hasChildren();
175177
if ($category->getIsAnchor()) {
176-
$type = $category->hasChildren() ? 'layered' : 'layered_without_children';
178+
$type = $hasChildren ? 'layered' : 'layered_without_children';
177179
} else {
178-
$type = $category->hasChildren() ? 'default' : 'default_without_children';
180+
$type = $hasChildren ? 'default' : 'default_without_children';
179181
}
180182

181-
if (!$category->hasChildren()) {
183+
if (!$hasChildren) {
182184
// Two levels removed from parent. Need to add default page type.
183185
$parentType = strtok($type, '_');
184186
$page->addPageLayoutHandles(['type' => $parentType]);

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

100644100755
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,18 @@ 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+
$currentCategory = $this->coreRegistry->registry('current_category');
116+
if ($currentCategory !== null && $currentCategory->getId() == $this->categoryId) {
117+
$category = $currentCategory;
118+
} else {
119+
$category = $this->categoryFactory->create()
120+
->setStoreId(
121+
$this->getLayer()
122+
->getCurrentStore()
123+
->getId()
124+
)
125+
->load($this->categoryId);
126+
}
122127
}
123128

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

0 commit comments

Comments
 (0)