Skip to content

Commit 333e383

Browse files
committed
MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories
1 parent 4869c54 commit 333e383

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function getCategoryProductsUrlRewrites(
139139
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
140140

141141
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
142-
$productCollection = $this->productCollectionFactory->create();//$category->getProductCollection()
142+
$productCollection = $this->productCollectionFactory->create();
143143

144144
$productCollection->addCategoriesFilter(['eq' => [$category->getEntityId()]])
145145
->setStoreId($storeId)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public function testGenerationForGlobalScope()
137137
->setStoreId(3);
138138
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')
139139
->will($this->returnValue([$current]));
140+
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor')
141+
->will($this->returnValue([$current]));
140142
$anchorCategories = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite([], $this->serializer);
141143
$anchorCategories->setRequestPath('category-4')
142144
->setStoreId(4);
@@ -178,6 +180,8 @@ public function testGenerationForSpecificStore()
178180
->will($this->returnValue([]));
179181
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')
180182
->will($this->returnValue([]));
183+
$this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor')
184+
->will($this->returnValue([]));
181185
$this->anchorUrlRewriteGenerator->expects($this->any())->method('generate')
182186
->will($this->returnValue([]));
183187

0 commit comments

Comments
 (0)