Skip to content

Instantly share code, notes, and snippets.

@mvenghaus
Created September 14, 2020 10:35
Show Gist options
  • Save mvenghaus/1aba55b6fb6965fadd42c594414c9f88 to your computer and use it in GitHub Desktop.
Save mvenghaus/1aba55b6fb6965fadd42c594414c9f88 to your computer and use it in GitHub Desktop.
--- magento/vendor/olegkoval/magento2-regenerate-url-rewrites/Model/RegenerateCategoryRewrites.php 2020-04-14 14:30:25.000000000 +0200
+++ magento/vendor/olegkoval/magento2-regenerate-url-rewrites/Model/RegenerateCategoryRewrites.php 2020-09-03 09:10:38.201178115 +0200
@@ -214,6 +214,7 @@
$category->getResource()->saveAttribute($category, 'url_key');
}
+ $category->setUrlPath(null);
$category->setUrlPath($this->_getCategoryUrlPathGenerator()->getUrlPath($category));
$category->getResource()->saveAttribute($category, 'url_path');
@@ -251,6 +252,7 @@
{
$categoriesCollection = $this->categoryCollectionFactory->create();
$categoriesCollection->addAttributeToSelect('name')
+ ->setStoreId($storeId)
->addAttributeToSelect('url_key')
->addAttributeToSelect('url_path')
// if we need to regenerate Url Rewrites for all categories then we select only top level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment