Skip to content

Commit 71faf62

Browse files
committed
ACP2E-3486: Default values are not set for date and time attributes with products RestAPI
1 parent 03d2a1b commit 71faf62

File tree

1 file changed

+8
-1
lines changed
  • app/code/Magento/Eav/Model/Entity/Attribute/Backend

1 file changed

+8
-1
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,20 @@ public function beforeSave($object)
5050
}
5151

5252
if ($value === null) {
53-
$value = $object->getData($attributeName);
53+
//$value = $object->getData($attributeName);
54+
$value = $this->getDefaultValue();
5455
}
5556

5657
$object->setData($attributeName, $value);
5758
$object->setData($attributeName . '_is_formated', true);
5859
}
5960

61+
$defaultValue = $this->getDefaultValue();
62+
if (is_null($object->getData($attributeName)) && $defaultValue !== null) {
63+
$object->setData($attributeName, $defaultValue);
64+
$object->setData($attributeName . '_is_formated', true);
65+
}
66+
6067
return $this;
6168
}
6269

0 commit comments

Comments
 (0)