Skip to content

Commit 318cbb5

Browse files
committed
MAGETWO-60154: [Backport] Saving category deletes UrlRewrites for subcategories and all products in them - for 2.1.x
1 parent ab1cb7b commit 318cbb5

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

app/code/Magento/CatalogUrlRewrite/Model/CategoryProductUrlPathGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
use Magento\Catalog\Model\Product\Visibility;
1010

1111
/**
12-
* Class ProductUrlRewriteGenerator.
13-
* @package Magento\CatalogUrlRewrite\Model
12+
* Generates product url rewrites based on all categories.
1413
*/
1514
class CategoryProductUrlPathGenerator
1615
{

app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ private function getCategoryWithOverriddenUrlKey($storeId, Category $category)
251251
if (!$isUrlKeyOverridden) {
252252
return $category;
253253
}
254+
254255
return $this->categoryRepository->get($category->getEntityId(), $storeId);
255256
}
256257
}

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryProductUrlPathGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Catalog\Model\ResourceModel\Category\Collection;
1313

1414
/**
15-
* Class CategoryProductUrlPathGeneratorTest
15+
* Tests CategoryProductUrlPathGenerator class.
1616
*/
1717
class CategoryProductUrlPathGeneratorTest extends \PHPUnit_Framework_TestCase
1818
{

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Magento\UrlRewrite\Model\OptionProvider;
1313
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
1414

15-
1615
/**
1716
* @magentoAppArea adminhtml
1817
*/
@@ -122,7 +121,7 @@ public function testGenerateUrlRewritesWithSaveHistory()
122121

123122
$categoryFilter = [
124123
UrlRewrite::ENTITY_TYPE => CategoryUrlRewriteGenerator::ENTITY_TYPE,
125-
UrlRewrite::ENTITY_ID => [3, 4, 5]
124+
UrlRewrite::ENTITY_ID => [3, 4, 5],
126125
];
127126
$actualResults = $this->getActualResults($categoryFilter);
128127
$categoryExpectedResult = [
@@ -135,7 +134,7 @@ public function testGenerateUrlRewritesWithSaveHistory()
135134
'category-1/category-1-1/category-1-1-1.html',
136135
'new-url/category-1-1/category-1-1-1.html',
137136
0,
138-
OptionProvider::PERMANENT
137+
OptionProvider::PERMANENT,
139138
],
140139
];
141140

0 commit comments

Comments
 (0)