Skip to content

Commit 7f46912

Browse files
committed
Merge branch '2.0.5_backlog' of ssh://github.corp.magento.com/magento-sparta/magento2ce into MDVA-237
2 parents 20807f1 + d614317 commit 7f46912

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-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()) {

lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
use Magento\Framework\Locale\Resolver;
1313
use Magento\Framework\View\Page\Config;
1414

15+
/**
16+
* @covers Magento\Framework\View\Page\Config
17+
*
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19+
*/
1520
class ConfigTest extends \PHPUnit_Framework_TestCase
1621
{
1722
/**

0 commit comments

Comments
 (0)