Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 28a22da

Browse files
author
giaphn
committed
- Update HTML Sitemap
1 parent 6cdb90d commit 28a22da

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Block/Sitemap.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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) {

etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
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/

0 commit comments

Comments
 (0)