From ca4dce18c2737773e374154008c300155415aec9 Mon Sep 17 00:00:00 2001 From: giaphn Date: Fri, 25 Mar 2022 16:34:35 +0700 Subject: [PATCH 1/7] - Update HTML Sitemap --- Block/Sitemap.php | 73 ++++-- Model/Source/DisplayType.php | 63 +++++ Model/Source/SortDirection.php | 63 +++++ Model/Source/SortProduct.php | 65 +++++ etc/adminhtml/system.xml | 350 +++++++++++++++----------- etc/config.xml | 75 +++--- view/frontend/templates/sitemap.phtml | 24 +- 7 files changed, 510 insertions(+), 203 deletions(-) create mode 100644 Model/Source/DisplayType.php create mode 100644 Model/Source/SortDirection.php create mode 100644 Model/Source/SortProduct.php diff --git a/Block/Sitemap.php b/Block/Sitemap.php index 04b6fde..08d9cff 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -26,15 +26,17 @@ use Magento\Catalog\Model\Product\Visibility as ProductVisibility; use Magento\Catalog\Model\ResourceModel\Category\Collection; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; -use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection; +use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollection; use Magento\CatalogInventory\Helper\Stock; use Magento\Cms\Model\Page; use Magento\Cms\Model\ResourceModel\Page\Collection as PageCollection; -use Magento\Framework\Data\Tree\Node\Collection as TreeCollection; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; use Mageplaza\Sitemap\Helper\Data as HelperConfig; +use Mageplaza\Sitemap\Model\Source\SortProduct; /** * Class Sitemap @@ -136,14 +138,30 @@ public function __construct( public function getProductCollection() { $limit = $this->_helper->getProductLimit() ?: self::DEFAULT_PRODUCT_LIMIT; - $collection = $this->productCollection + $collection = $this->productCollection->create() ->setVisibility($this->productVisibility->getVisibleInCatalogIds()) ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents() ->setPageSize($limit) ->addAttributeToSelect('*'); - if (!$this->_helper->getConfigValue('cataloginventory/options/show_out_of_stock')) { + + $sortProductBy = $this->_helper->getHtmlSitemapConfig('product_sorting'); + $sortProductDir = $this->_helper->getHtmlSitemapConfig('product_sorting_dir'); + + switch ($sortProductBy) { + case SortProduct::PRODUCT_NAME: + $collection->setOrder('name', $sortProductDir); + break; + case SortProduct::PRICE: + $collection->setOrder('price', $sortProductDir); + break; + default: + $collection->setOrder('entity_id', $sortProductDir); + break; + } + + if (!$this->_helper->getHtmlSitemapConfig('out_of_stock_products')) { $this->_stockFilter->addInStockFilterToCollection($collection); } @@ -151,13 +169,30 @@ public function getProductCollection() } /** - * Get category collection - * - * @return TreeCollection + * @return Collection|AbstractDb + * @throws NoSuchEntityException + * @throws LocalizedException */ public function getCategoryCollection() { - return $this->_categoryHelper->getStoreCategories(false, true); + $categoryCollection = $this->_categoryCollection->create()->addAttributeToSelect('*') + ->setStoreId($this->_storeManager->getStore()->getId()) + ->addFieldToFilter('is_active', 1) + ->addFieldToFilter('include_in_menu', 1) + ->addFieldToFilter('entity_id', ['nin' => [1, 2]])->setOrder('path'); + $excludeCategories = $this->_helper->getHtmlSitemapConfig('category_page'); + if (!empty($excludeCategories)) { + $excludeCategories = array_map('trim', explode( + "\n", + $excludeCategories + )); + + foreach ($excludeCategories as $excludeCategory) { + $categoryCollection->addFieldToFilter('url_path', ['nlike' => $excludeCategory . '%']); + } + } + + return $categoryCollection; } /** @@ -223,16 +258,15 @@ public function getAdditionLinksCollection() } /** - * Render link element - * - * @param string $link - * @param string $title + * @param $link + * @param $title + * @param $level * * @return string */ - public function renderLinkElement($link, $title) + public function renderLinkElement($link, $title, $level = null) { - return '
  • ' . __($title) . '
  • '; + return '
  • ' . __($title) . '
  • '; } // phpcs:disable Generic.Metrics.NestingLevel @@ -260,7 +294,8 @@ public function renderSection($section, $config, $title, $collection) if (!$category->getData('mp_exclude_sitemap')) { $html .= $this->renderLinkElement( $this->getCategoryUrl($item->getId()), - $item->getName() + $item->getName(), + $item->getLevel() ); } break; @@ -334,4 +369,12 @@ public function isEnableHtmlSitemap() { return $this->_helper->isEnableHtmlSiteMap(); } + + /** + * @return array|bool|mixed + */ + public function getCategoryDisplayType() + { + return $this->_helper->getHtmlSitemapConfig('display_type'); + } } diff --git a/Model/Source/DisplayType.php b/Model/Source/DisplayType.php new file mode 100644 index 0000000..85e6db4 --- /dev/null +++ b/Model/Source/DisplayType.php @@ -0,0 +1,63 @@ +toArray() as $value => $label) { + $options[] = [ + 'value' => $value, + 'label' => $label + ]; + } + + return $options; + } + + /** + * Get options in "key-value" format + * + * @return array + */ + public function toArray() + { + return [ + self::LIST => __('List'), + self::DROPDOWN => __('Dropdown'), + ]; + } +} diff --git a/Model/Source/SortDirection.php b/Model/Source/SortDirection.php new file mode 100644 index 0000000..e543f53 --- /dev/null +++ b/Model/Source/SortDirection.php @@ -0,0 +1,63 @@ +toArray() as $value => $label) { + $options[] = [ + 'value' => $value, + 'label' => $label + ]; + } + + return $options; + } + + /** + * Get options in "key-value" format + * + * @return array + */ + public function toArray() + { + return [ + self::ASC => __('Ascending'), + self::DESC => __('Descending'), + ]; + } +} diff --git a/Model/Source/SortProduct.php b/Model/Source/SortProduct.php new file mode 100644 index 0000000..e29f982 --- /dev/null +++ b/Model/Source/SortProduct.php @@ -0,0 +1,65 @@ +toArray() as $value => $label) { + $options[] = [ + 'value' => $value, + 'label' => $label + ]; + } + + return $options; + } + + /** + * Get options in "key-value" format + * + * @return array + */ + public function toArray() + { + return [ + self::PRODUCT_IDS => __('Product IDs'), + self::PRODUCT_NAME => __('Product Name'), + self::PRICE => __('Price') + ]; + } +} diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 4a5d308..ec0e7fc 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -1,151 +1,199 @@ - - - - -
    - - - - - Magento\Config\Model\Config\Source\Yesno - this article ]]> - - - - Magento\Config\Model\Config\Source\Yesno - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - 1 - - - - - validate-digits validate-not-negative-number - - - 1 - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - 1 - 1 - - - - - Mageplaza\Sitemap\Model\Source\Page - - 1 - 1 - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - 1 - - - - - - - - One link per line.
    - Example:
    -
    - http://www.mageplaza.com/,Mageplaza
    - https://magento.com/,Magento -
    - ]]> -
    - - 1 - 1 - -
    - - - Magento\Config\Model\Config\Source\Yesno - - 1 - - -
    - - - - - Magento\Config\Model\Config\Source\Yesno - In sitemap file, it will remove the link of the CMS page using for homepage. - - - - Magento\Config\Model\Config\Source\Yesno - Yes, if you want to add more custom links into sitemap XML file. - - - - - 1 - - One link per line. - - - - Magento\Sitemap\Model\Config\Source\Frequency - - 1 - - always, hourly, daily, weekly, monthly, yearly, never. Learn more.]]> - - - - validate-number validate-digits-range digits-range-0-1 - - 1 - - - - -
    -
    -
    + + + + +
    + + + + + Magento\Config\Model\Config\Source\Yesno + this article ]]> + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + + + + + 1 + 1 + + + + + Mageplaza\Sitemap\Model\Source\DisplayType + + 1 + 1 + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + Mageplaza\Sitemap\Model\Source\SortProduct + + 1 + + Choose how to arrange and display products in HTML Site Map. + + + + Mageplaza\Sitemap\Model\Source\SortDirection + + 1 + + + + + Magento\Config\Model\Config\Source\Yesno + If yes, will hide out of stock products in HTML Site Map. + + 1 + + + + + validate-digits validate-not-negative-number + + + 1 + 1 + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + 1 + + + + + Mageplaza\Sitemap\Model\Source\Page + + 1 + 1 + 1 + + + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + + + + + + - One link per line.
    + Example:
    +
    + http://www.mageplaza.com/,Mageplaza
    + https://magento.com/,Magento +
    + ]]> +
    + + 1 + 1 + +
    + + + Magento\Config\Model\Config\Source\Yesno + + 1 + + +
    + + + + + Magento\Config\Model\Config\Source\Yesno + In sitemap file, it will remove the link of the CMS page using for homepage. + + + + Magento\Config\Model\Config\Source\Yesno + Yes, if you want to add more custom links into sitemap XML file. + + + + + 1 + + One link per line. + + + + Magento\Sitemap\Model\Config\Source\Frequency + + 1 + + always, hourly, daily, weekly, monthly, yearly, never. Learn more.]]> + + + + validate-number validate-digits-range digits-range-0-1 + + 1 + + + + +
    +
    +
    diff --git a/etc/config.xml b/etc/config.xml index 3fe8201..4b18a8a 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -1,35 +1,40 @@ - - - - - - - 1 - - - 1 - daily - - - - \ No newline at end of file + + + + + + + 1 + 0 + list + product_ids + asc + 1 + + + 1 + daily + + + + diff --git a/view/frontend/templates/sitemap.phtml b/view/frontend/templates/sitemap.phtml index 5fad0f3..854ee81 100755 --- a/view/frontend/templates/sitemap.phtml +++ b/view/frontend/templates/sitemap.phtml @@ -19,10 +19,30 @@ * @license https://www.mageplaza.com/LICENSE.txt */ -/** @var \Mageplaza\Sitemap\Block\Sitemap $block */ +use Mageplaza\Sitemap\Block\Sitemap; + +/** @var Sitemap $block */ ?>
    renderHtmlSiteMap() ?>
    - +getCategoryDisplayType() == 'dropdown') : +?> + + From aab9a9a15105533b91e9f4ded1daafae4316f21a Mon Sep 17 00:00:00 2001 From: giaphn Date: Thu, 7 Apr 2022 10:57:35 +0700 Subject: [PATCH 2/7] - Update HTML Sitemap --- Block/Sitemap.php | 62 ++++++++++++++++++++++++--- etc/adminhtml/system.xml | 9 ++-- view/frontend/templates/sitemap.phtml | 2 +- 3 files changed, 63 insertions(+), 10 deletions(-) diff --git a/Block/Sitemap.php b/Block/Sitemap.php index 08d9cff..533a510 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -21,6 +21,7 @@ namespace Mageplaza\Sitemap\Block; +use Exception; use Magento\Catalog\Helper\Category; use Magento\Catalog\Model\CategoryRepository; use Magento\Catalog\Model\Product\Visibility as ProductVisibility; @@ -143,10 +144,9 @@ public function getProductCollection() ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents() - ->setPageSize($limit) ->addAttributeToSelect('*'); - $sortProductBy = $this->_helper->getHtmlSitemapConfig('product_sorting'); + $sortProductBy = $this->_helper->getHtmlSitemapConfig('product_sorting'); $sortProductDir = $this->_helper->getHtmlSitemapConfig('product_sorting_dir'); switch ($sortProductBy) { @@ -154,7 +154,7 @@ public function getProductCollection() $collection->setOrder('name', $sortProductDir); break; case SortProduct::PRICE: - $collection->setOrder('price', $sortProductDir); + $collection->setOrder('minimal_price', $sortProductDir); break; default: $collection->setOrder('entity_id', $sortProductDir); @@ -165,6 +165,8 @@ public function getProductCollection() $this->_stockFilter->addInStockFilterToCollection($collection); } + $collection->setPageSize($limit); + return $collection; } @@ -180,7 +182,8 @@ public function getCategoryCollection() ->addFieldToFilter('is_active', 1) ->addFieldToFilter('include_in_menu', 1) ->addFieldToFilter('entity_id', ['nin' => [1, 2]])->setOrder('path'); - $excludeCategories = $this->_helper->getHtmlSitemapConfig('category_page'); + + $excludeCategories = $this->_helper->getHtmlSitemapConfig('category_page'); if (!empty($excludeCategories)) { $excludeCategories = array_map('trim', explode( "\n", @@ -188,13 +191,62 @@ public function getCategoryCollection() )); foreach ($excludeCategories as $excludeCategory) { - $categoryCollection->addFieldToFilter('url_path', ['nlike' => $excludeCategory . '%']); + try { + $testRegex = preg_match($excludeCategory, ''); + if ($testRegex) { + $excludeCategoriesIds = $this->filterCategoryWithRegex($excludeCategory); + if (count($excludeCategoriesIds)) { + $categoryCollection->addFieldToFilter('entiry_id', ['nin' => $excludeCategoriesIds]); + } + } + } catch (Exception $e) { + $excludePath = $this->getExcludePath($excludeCategory); + $categoryCollection->addFieldToFilter('url_path', ['nlike' => '%' . $excludePath . '%']); + } } } return $categoryCollection; } + /** + * @param $regex + * + * @return array + * @throws LocalizedException + * @throws NoSuchEntityException + */ + protected function filterCategoryWithRegex($regex) + { + $excludeCategoriesIds = []; + $categoryCollection = $this->_categoryCollection->create()->addAttributeToSelect('*') + ->setStoreId($this->_storeManager->getStore()->getId()); + foreach ($categoryCollection as $category) { + if (!preg_match($regex, $category->getUrlPath())) { + $excludeCategoriesIds[] = $category->getId(); + } + } + + return $excludeCategoriesIds; + } + + /** + * @param $excludeCategory + * + * @return string + */ + protected function getExcludePath($excludeCategory) + { + if ($excludeCategory[0] == '/') { + $excludeCategory = substr($excludeCategory, 1); + } + if ($excludeCategory[-1] == '/') { + $excludeCategory = substr($excludeCategory, 0, -1); + } + + return $excludeCategory; + } + /** * @param int $categoryId * diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index ec0e7fc..deb4dd8 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -41,7 +41,7 @@ Mageplaza\Sitemap\Model\Source\DisplayType + Choose style to display categories in HTML Sitemap. 1 1 @@ -73,7 +74,7 @@ Mageplaza\Sitemap\Model\Source\SortProduct - 1 + 1 Choose how to arrange and display products in HTML Site Map. @@ -81,7 +82,7 @@ Mageplaza\Sitemap\Model\Source\SortDirection - 1 + 1 @@ -89,7 +90,7 @@ Magento\Config\Model\Config\Source\Yesno If yes, will hide out of stock products in HTML Site Map. - 1 + 1 diff --git a/view/frontend/templates/sitemap.phtml b/view/frontend/templates/sitemap.phtml index 854ee81..19b29ca 100755 --- a/view/frontend/templates/sitemap.phtml +++ b/view/frontend/templates/sitemap.phtml @@ -38,7 +38,7 @@ use Mageplaza\Sitemap\Block\Sitemap; var elementClass = $(this).attr('class'), level, margin; if (elementClass.trim()) { - level = (elementClass.slice(-1) - 1) * 5; + level = (elementClass.slice(-1) - 2) * 5; margin = level + '%'; $(this).css('margin-left', margin); } From ddf64d173936229caa6ec9535d90b728339dc2d2 Mon Sep 17 00:00:00 2001 From: giaphn Date: Thu, 7 Apr 2022 13:39:45 +0700 Subject: [PATCH 3/7] - Update HTML Sitemap --- Block/Sitemap.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Block/Sitemap.php b/Block/Sitemap.php index 533a510..925a74e 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -177,11 +177,13 @@ public function getProductCollection() */ public function getCategoryCollection() { + $storeRootCategoryId = $this->_storeManager->getStore()->getRootCategoryId(); + $storeRootCategory = $this->categoryRepository->get($storeRootCategoryId); $categoryCollection = $this->_categoryCollection->create()->addAttributeToSelect('*') - ->setStoreId($this->_storeManager->getStore()->getId()) + ->addFieldToFilter('entity_id', ['in' => $storeRootCategory->getAllChildren(true)]) ->addFieldToFilter('is_active', 1) ->addFieldToFilter('include_in_menu', 1) - ->addFieldToFilter('entity_id', ['nin' => [1, 2]])->setOrder('path'); + ->addFieldToFilter('entity_id', ['nin' => [$storeRootCategoryId]])->setOrder('path'); $excludeCategories = $this->_helper->getHtmlSitemapConfig('category_page'); if (!empty($excludeCategories)) { @@ -196,7 +198,7 @@ public function getCategoryCollection() if ($testRegex) { $excludeCategoriesIds = $this->filterCategoryWithRegex($excludeCategory); if (count($excludeCategoriesIds)) { - $categoryCollection->addFieldToFilter('entiry_id', ['nin' => $excludeCategoriesIds]); + $categoryCollection->addFieldToFilter('entity_id', ['nin' => $excludeCategoriesIds]); } } } catch (Exception $e) { From 27fb4193d2f6bed314d59485f69f408e2b9dec08 Mon Sep 17 00:00:00 2001 From: giaphn Date: Thu, 7 Apr 2022 16:05:07 +0700 Subject: [PATCH 4/7] - Update HTML Sitemap --- Block/Sitemap.php | 64 +++++++++++++++++++++++++++++++++------- etc/adminhtml/system.xml | 8 ++--- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/Block/Sitemap.php b/Block/Sitemap.php index 925a74e..c588f2f 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -183,7 +183,7 @@ public function getCategoryCollection() ->addFieldToFilter('entity_id', ['in' => $storeRootCategory->getAllChildren(true)]) ->addFieldToFilter('is_active', 1) ->addFieldToFilter('include_in_menu', 1) - ->addFieldToFilter('entity_id', ['nin' => [$storeRootCategoryId]])->setOrder('path'); + ->addFieldToFilter('entity_id', ['nin' => [$storeRootCategoryId]]); $excludeCategories = $this->_helper->getHtmlSitemapConfig('category_page'); if (!empty($excludeCategories)) { @@ -192,36 +192,80 @@ public function getCategoryCollection() $excludeCategories )); + $allExcludeIds = ''; foreach ($excludeCategories as $excludeCategory) { try { $testRegex = preg_match($excludeCategory, ''); if ($testRegex) { - $excludeCategoriesIds = $this->filterCategoryWithRegex($excludeCategory); - if (count($excludeCategoriesIds)) { - $categoryCollection->addFieldToFilter('entity_id', ['nin' => $excludeCategoriesIds]); - } + $allExcludeIds .= '-' . $this->filterCategoryWithRegex($excludeCategory); + } else { + $excludePath = $this->getExcludePath($excludeCategory); + $allExcludeIds .= '-' . $this->filterCategoryWithPath($excludePath, $categoryCollection); } } catch (Exception $e) { $excludePath = $this->getExcludePath($excludeCategory); - $categoryCollection->addFieldToFilter('url_path', ['nlike' => '%' . $excludePath . '%']); + $allExcludeIds .= '-' . $this->filterCategoryWithPath($excludePath, $categoryCollection); } } + + $excludeIds = explode('-', $allExcludeIds); + $categoryCollection->addFieldToFilter('entity_id', ['nin' => $excludeIds]); } - return $categoryCollection; + return $this->_categoryCollection->create()->addAttributeToSelect('*') + ->addFieldToFilter('entity_id', ['in' => $categoryCollection->getAllIds()])->setOrder('path'); + } + + /** + * @param $path + * @param $categoryCollection + * + * @return string + */ + protected function filterCategoryWithPath($path, $categoryCollection) + { + $excludeIds = []; + foreach ($categoryCollection as $category) { + if ($this->isExcludeCategory($category, $path)) { + $excludeIds[] = $category->getData('entity_id'); + } + } + + return implode('-', $excludeIds); + } + + /** + * @param $category + * @param $path + * + * @return bool + */ + public function isExcludeCategory($category, $path) + { + $filterPath = explode('/', $path); + $categoryPath = $category->getUrlPath(); + $categoryPath = explode('/', $categoryPath); + + foreach ($filterPath as $pathInfo) { + if (!in_array($pathInfo, $categoryPath)) { + return false; + } + } + + return true; } /** * @param $regex * - * @return array + * @return string * @throws LocalizedException * @throws NoSuchEntityException */ protected function filterCategoryWithRegex($regex) { $excludeCategoriesIds = []; - $categoryCollection = $this->_categoryCollection->create()->addAttributeToSelect('*') + $categoryCollection = $this->_categoryCollection->create()->addAttributeToSelect('*') ->setStoreId($this->_storeManager->getStore()->getId()); foreach ($categoryCollection as $category) { if (!preg_match($regex, $category->getUrlPath())) { @@ -229,7 +273,7 @@ protected function filterCategoryWithRegex($regex) } } - return $excludeCategoriesIds; + return implode('-', $excludeCategoriesIds); } /** diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index deb4dd8..d144bba 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -42,10 +42,10 @@ E.g: Do not display with the category pages including /men/ such as:
    + /men/top
    + /men/top/t-shirt
    + /clothes/men/
    Support Regular expression ]]>
    From 6ba771dc2135aaa195244505a9912cdfab285224 Mon Sep 17 00:00:00 2001 From: giaphn Date: Fri, 8 Apr 2022 09:22:22 +0700 Subject: [PATCH 5/7] - Update HTML Sitemap --- Block/Sitemap.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Block/Sitemap.php b/Block/Sitemap.php index c588f2f..9d914fc 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -194,17 +194,19 @@ public function getCategoryCollection() $allExcludeIds = ''; foreach ($excludeCategories as $excludeCategory) { - try { - $testRegex = preg_match($excludeCategory, ''); - if ($testRegex) { - $allExcludeIds .= '-' . $this->filterCategoryWithRegex($excludeCategory); - } else { + if (!empty($excludeCategory)) { + try { + $testRegex = preg_match($excludeCategory, ''); + if ($testRegex) { + $allExcludeIds .= '-' . $this->filterCategoryWithRegex($excludeCategory); + } else { + $excludePath = $this->getExcludePath($excludeCategory); + $allExcludeIds .= '-' . $this->filterCategoryWithPath($excludePath, $categoryCollection); + } + } catch (Exception $e) { $excludePath = $this->getExcludePath($excludeCategory); $allExcludeIds .= '-' . $this->filterCategoryWithPath($excludePath, $categoryCollection); } - } catch (Exception $e) { - $excludePath = $this->getExcludePath($excludeCategory); - $allExcludeIds .= '-' . $this->filterCategoryWithPath($excludePath, $categoryCollection); } } From 0b20d26351176293316c5b0fa85341a9e03a6aa0 Mon Sep 17 00:00:00 2001 From: giaphn Date: Fri, 8 Apr 2022 13:22:06 +0700 Subject: [PATCH 6/7] - Update HTML Sitemap --- Block/Sitemap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Block/Sitemap.php b/Block/Sitemap.php index 9d914fc..8faed3c 100755 --- a/Block/Sitemap.php +++ b/Block/Sitemap.php @@ -161,7 +161,7 @@ public function getProductCollection() break; } - if (!$this->_helper->getHtmlSitemapConfig('out_of_stock_products')) { + if ($this->_helper->getHtmlSitemapConfig('out_of_stock_products')) { $this->_stockFilter->addInStockFilterToCollection($collection); } From 66bd5e822b07ce1bfa9e3d346db9105152ea7882 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 24 Jun 2022 16:00:46 +0700 Subject: [PATCH 7/7] Clean code --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 59ee280..7f8832f 100755 --- a/composer.json +++ b/composer.json @@ -2,11 +2,11 @@ "name": "mageplaza/module-sitemap", "description": "Magento 2 Google XML Sitemap extension", "require": { - "mageplaza/module-core": "^1.4.5", - "mageplaza/magento-2-seo-extension": "^2.1.0" + "mageplaza/module-core": "^1.4.12", + "mageplaza/magento-2-seo-extension": "^2.3.0" }, "type": "magento2-module", - "version": "1.1.0", + "version": "1.2.0", "license": "proprietary", "authors": [ {