Skip to content

Commit 10a7065

Browse files
authored
Merge pull request #6627 from magento-tsg-csl3/2.4-develop-pr52
[TSG-CSL3] For 2.4 (pr52)
2 parents 81ad0b4 + 1eca4e2 commit 10a7065

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ private function isAttributeShouldNotBeUpdated(Product $product, array $useDefau
102102
{
103103
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === '1';
104104

105-
return ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute));
105+
return ($value === '' && $considerUseDefaultsAttribute && ($product->getData($attribute) === null));
106106
}
107107
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilterTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,29 @@ public function setupInputDataProvider()
216216
['description', null, 'descr text'],
217217
],
218218
],
219+
'update_product_with_empty_string_attribute' => [
220+
'requestProductData' => [
221+
'name' => 'testName3',
222+
'sku' => 'testSku3',
223+
'price' => '103',
224+
'special_price' => '100',
225+
'custom_attribute' => '',
226+
],
227+
'useDefaults' => [],
228+
'expectedProductData' => [
229+
'name' => 'testName3',
230+
'sku' => 'testSku3',
231+
'price' => '103',
232+
'special_price' => '100',
233+
'custom_attribute' => '',
234+
],
235+
'initialProductData' => [
236+
['name', null, 'testName2'],
237+
['sku', null, 'testSku2'],
238+
['price', null, '101'],
239+
['custom_attribute', null, '0'],
240+
],
241+
],
219242
];
220243
}
221244

app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ public function afterChangeParent(
6767
$categoryStoreId = $category->getStoreId();
6868
foreach ($category->getStoreIds() as $storeId) {
6969
$category->setStoreId($storeId);
70-
if (!$this->isGlobalScope($storeId)) {
71-
$this->updateCategoryUrlKeyForStore($category);
72-
$category->unsUrlPath();
73-
$category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
74-
$category->getResource()->saveAttribute($category, 'url_path');
75-
$this->updateUrlPathForChildren($category);
76-
}
70+
$this->updateCategoryUrlKeyForStore($category);
71+
$category->unsUrlPath();
72+
$category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
73+
$category->getResource()->saveAttribute($category, 'url_path');
74+
$this->updateUrlPathForChildren($category);
7775
}
7876
$category->setStoreId($categoryStoreId);
7977

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,26 @@ protected function setUp(): void
9191
public function testAfterChangeParent()
9292
{
9393
$urlPath = 'test/path';
94-
$storeIds = [1];
94+
$storeIds = [0, 1];
9595
$originalCategory = $this->getMockBuilder(Category::class)
9696
->disableOriginalConstructor()
9797
->getMock();
9898
$this->categoryFactory->method('create')
9999
->willReturn($originalCategory);
100-
101100
$this->categoryMock->method('getResource')
102101
->willReturn($this->subjectMock);
103102
$this->categoryMock->expects($this->once())
104103
->method('getStoreIds')
105104
->willReturn($storeIds);
106-
$this->childrenCategoriesProviderMock->expects($this->once())
105+
$this->childrenCategoriesProviderMock->expects($this->exactly(2))
107106
->method('getChildren')
108107
->with($this->categoryMock, true)
109108
->willReturn([]);
110-
$this->categoryUrlPathGeneratorMock->expects($this->once())
109+
$this->categoryUrlPathGeneratorMock->expects($this->exactly(2))
111110
->method('getUrlPath')
112111
->with($this->categoryMock)
113112
->willReturn($urlPath);
114-
$this->categoryMock->expects($this->once())
113+
$this->categoryMock->expects($this->exactly(2))
115114
->method('setUrlPath')
116115
->with($urlPath);
117116
$this->assertSame(

0 commit comments

Comments
 (0)