File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 4040 */
4141class MegaMenu extends Post
4242{
43+ const UNCATEGORISED_ID = 1 ;
44+
4345 protected $ _template = 'Skywire_WordpressApi::mega-menu.phtml ' ;
4446
4547 /**
@@ -103,9 +105,13 @@ public function getCategories()
103105 {
104106 $ allCategories = [];
105107 $ page = 1 ;
108+
106109 try {
107110 do {
108- $ categories = $ this ->categoryApi ->getCollection (['page ' => $ page ]);
111+ $ categories = $ this ->categoryApi ->getCollection ([
112+ 'page ' => $ page ,
113+ 'exclude ' => self ::UNCATEGORISED_ID
114+ ]);
109115 $ allCategories += $ categories ->getItems ();
110116 ++$ page ;
111117 } while ($ page <= $ categories ->getLastPageNumber ());
@@ -114,7 +120,12 @@ public function getCategories()
114120 }
115121
116122 foreach ($ allCategories as $ category ) {
117- $ children = $ this ->categoryApi ->getCollection (['parent ' => $ category ->getId (), 'page_size ' => 100 ]);
123+ $ children = $ this ->categoryApi ->getCollection (
124+ [
125+ 'parent ' => $ category ->getId (),
126+ 'page_size ' => 100 ,
127+ 'exclude ' => self ::UNCATEGORISED_ID
128+ ]);
118129 $ category ->setChildren ($ children );
119130 }
120131
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" ?>
22<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
3- <module name =" Skywire_WordpressApi" setup_version =" 1.3.3 " >
3+ <module name =" Skywire_WordpressApi" setup_version =" 1.3.4 " >
44 </module >
55</config >
You can’t perform that action at this time.
0 commit comments