This repository was archived by the owner on Feb 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,13 @@ public function getProductCollection()
177177 */
178178 public function getCategoryCollection ()
179179 {
180+ $ storeRootCategoryId = $ this ->_storeManager ->getStore ()->getRootCategoryId ();
181+ $ storeRootCategory = $ this ->categoryRepository ->get ($ storeRootCategoryId );
180182 $ categoryCollection = $ this ->_categoryCollection ->create ()->addAttributeToSelect ('* ' )
181- ->setStoreId ( $ this -> _storeManager -> getStore ()-> getId () )
183+ ->addFieldToFilter ( ' entity_id ' , [ ' in ' => $ storeRootCategory -> getAllChildren ( true )] )
182184 ->addFieldToFilter ('is_active ' , 1 )
183185 ->addFieldToFilter ('include_in_menu ' , 1 )
184- ->addFieldToFilter ('entity_id ' , ['nin ' => [1 , 2 ]])->setOrder ('path ' );
186+ ->addFieldToFilter ('entity_id ' , ['nin ' => [$ storeRootCategoryId ]])->setOrder ('path ' );
185187
186188 $ excludeCategories = $ this ->_helper ->getHtmlSitemapConfig ('category_page ' );
187189 if (!empty ($ excludeCategories )) {
@@ -196,7 +198,7 @@ public function getCategoryCollection()
196198 if ($ testRegex ) {
197199 $ excludeCategoriesIds = $ this ->filterCategoryWithRegex ($ excludeCategory );
198200 if (count ($ excludeCategoriesIds )) {
199- $ categoryCollection ->addFieldToFilter ('entiry_id ' , ['nin ' => $ excludeCategoriesIds ]);
201+ $ categoryCollection ->addFieldToFilter ('entity_id ' , ['nin ' => $ excludeCategoriesIds ]);
200202 }
201203 }
202204 } catch (Exception $ e ) {
Original file line number Diff line number Diff line change 4242 <comment >
4343 <![CDATA[
4444 Display Category Pages in HTML Sitemap except those with the above selected string. Separated by a line break.
45- E.g: Do not display with the category pages including /men/ such as:
45+ <br/> E.g: Do not display with the category pages including /men/ such as:
4646 /men/top
4747 /men/top/t-shirt
4848 /clothes/men/
You can’t perform that action at this time.
0 commit comments