|
I’m having the following error when I try to save two new fields I created (Country and Company) in the Customer Address (Billing). The information for these fields are provides from the Customer form: It’s like this how i try to save it.
$customerAddressId = Mage::getSingleton(’customer/session’)->getCustomer()->getDefaultBilling();
$address = Mage::getModel(’customer/address’)->load($customerAddressId);
$address->setCountry($customer->getCountry());
$address->setCompany($customer->getCompany());
$address->save();
At the moment to make the post i have this database error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento2`.`customer_address_entity`, CONSTRAINT `FK_CUSTOMER_ADDRESS_CUSTOMER_ID` FOREIGN KEY (`parent_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE)
I read that I would resolve it if I change the all tables engine for innodb like this:
alter table the_table engine=innodb;
but doesn’t work
Anyone can help me? I really need it ....
|