File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,14 @@ public function getLayer()
136136 */
137137 public function getLoadedProductCollection ()
138138 {
139- return $ this ->_getProductCollection ();
139+ $ collection = $ this ->_getProductCollection ();
140+
141+ $ categoryId = $ this ->getLayer ()->getCurrentCategory ()->getId ();
142+ foreach ($ collection as $ product ) {
143+ $ product ->setData ('category_id ' , $ categoryId );
144+ }
145+
146+ return $ collection ;
140147 }
141148
142149 /**
Original file line number Diff line number Diff line change @@ -725,9 +725,14 @@ public function getIdBySku($sku)
725725 */
726726 public function getCategoryId ()
727727 {
728+ if ($ this ->hasData ('category_id ' )) {
729+ return $ this ->getData ('category_id ' );
730+ }
728731 $ category = $ this ->_registry ->registry ('current_category ' );
729- if ($ category && in_array ($ category ->getId (), $ this ->getCategoryIds ())) {
730- return $ category ->getId ();
732+ $ categoryId = $ category ? $ category ->getId () : null ;
733+ if ($ categoryId && in_array ($ categoryId , $ this ->getCategoryIds ())) {
734+ $ this ->setData ('category_id ' , $ categoryId );
735+ return $ categoryId ;
731736 }
732737 return false ;
733738 }
You can’t perform that action at this time.
0 commit comments