Skip to content

Commit b77ff13

Browse files
likemusicmzeis
authored andcommitted
change attributeShouldNotBeUpdated() visibility to protected
1 parent 1fce0a5 commit b77ff13

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,24 @@ class AttributeFilter
2828
public function prepareProductAttributes(Product $product, array $productData, array $useDefaults)
2929
{
3030
foreach ($productData as $attribute => $value) {
31-
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
32-
if ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute)) {
31+
if ($this->attributeShouldNotBeUpdated($product, $useDefaults, $attribute, $value)) {
3332
unset($productData[$attribute]);
3433
}
3534
}
3635
return $productData;
3736
}
37+
38+
/**
39+
* @param $product
40+
* @param $useDefaults
41+
* @param $attribute
42+
* @param $value
43+
* @return bool
44+
*/
45+
protected function attributeShouldNotBeUpdated(Product $product, $useDefaults, $attribute, $value)
46+
{
47+
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
48+
49+
return ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute));
50+
}
3851
}

0 commit comments

Comments
 (0)