File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
Model/Layer/Filter/DataProvider Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -172,13 +172,15 @@ public function execute()
172
172
if ($ settings ->getPageLayout ()) {
173
173
$ page ->getConfig ()->setPageLayout ($ settings ->getPageLayout ());
174
174
}
175
+
176
+ $ hasChildren = $ category ->hasChildren ();
175
177
if ($ category ->getIsAnchor ()) {
176
- $ type = $ category -> hasChildren () ? 'layered ' : 'layered_without_children ' ;
178
+ $ type = $ hasChildren ? 'layered ' : 'layered_without_children ' ;
177
179
} else {
178
- $ type = $ category -> hasChildren () ? 'default ' : 'default_without_children ' ;
180
+ $ type = $ hasChildren ? 'default ' : 'default_without_children ' ;
179
181
}
180
182
181
- if (!$ category -> hasChildren () ) {
183
+ if (!$ hasChildren ) {
182
184
// Two levels removed from parent. Need to add default page type.
183
185
$ parentType = strtok ($ type , '_ ' );
184
186
$ page ->addPageLayoutHandles (['type ' => $ parentType ]);
Original file line number Diff line number Diff line change @@ -112,13 +112,18 @@ public function getCategory()
112
112
/** @var CategoryModel|null $category */
113
113
$ category = null ;
114
114
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
+ }
122
127
}
123
128
124
129
if ($ category === null || !$ category ->getId ()) {
You can’t perform that action at this time.
0 commit comments