Skip to content

Commit 890ae82

Browse files
author
Serhii Balko
committed
Merge remote-tracking branch 'origin/MC-40773' into 2.4-develop-pr52
2 parents 2243b48 + 9892fc7 commit 890ae82

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
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

0 commit comments

Comments
 (0)