Skip to content

Commit 056fce7

Browse files
aohorodnykYaroslav Voronoy
authored andcommitted
MAGETWO-49004: Flat categories Query duplication on category page
- Fixed duplicated sql queries
1 parent bc54a51 commit 056fce7

File tree

1 file changed

+5
-3
lines changed
  • app/code/Magento/Catalog/Controller/Category

1 file changed

+5
-3
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]);

0 commit comments

Comments
 (0)