You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new customer with a DOB set or select an existing customer that has a DOB set
On the customer detail page -> Account Information tab, clear the customer DOB that was previously set and save the customer
Expected result (*)
The customer DOB should be cleared and the attribute deleted from the DB (table customer_entity_datetime)
Actual result (*)
Nothing happens, the DOB is not removed and the original value is kept
Debug
I debugged this isue and tracked down the issue to the following code:
File: Mage_Eav_Model_Attribute_Data_Date
Line 94-103
public function compactValue($value)
{
if ($value !== false) {
if (empty($value)) {
$value = null;
}
$this->getEntity()->setDataUsingMethod($this->getAttribute()->getAttributeCode(), $value);
}
return $this;
}
Specifically line 96 if ($value !== false) {. When trying to remove an attribute value in an EAV entity like Customer, the form sets the value of the attribute to false, and this code does not set the value from the form to the customer entity, basically ignoring the attribute update.
The following classes and methods are involved in this request:
Mage_Adminhtml_CustomerController::saveAction()
Which uses:
class Mage_Customer_Model_Form extends Mage_Eav_Model_Form
To load the request data, validate and set the data into the customer entity (via the compactData() method). This method in turn loads the attribute data model for each EAV attribute based on the attribute type, and uses the data model to manipulate the attribute data values from the request, ultimately calling the compactValue function in each attribute data model to set the request data in the customer entity model before saving the model.
The text was updated successfully, but these errors were encountered:
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Debug
I debugged this isue and tracked down the issue to the following code:
Specifically line 96
if ($value !== false) {
. When trying to remove an attribute value in an EAV entity like Customer, the form sets the value of the attribute to false, and this code does not set the value from the form to the customer entity, basically ignoring the attribute update.The following classes and methods are involved in this request:
Which uses:
To load the request data, validate and set the data into the customer entity (via the
compactData()
method). This method in turn loads the attribute data model for each EAV attribute based on the attribute type, and uses the data model to manipulate the attribute data values from the request, ultimately calling thecompactValue
function in each attribute data model to set the request data in the customer entity model before saving the model.The text was updated successfully, but these errors were encountered: