问题
can anyone suggest me how can I update customer address based on address id and customer id. I have tried searching it but it is saying that edit address is not possible even I tried also it is not happening.
I think it might be possible through sql query, but I dont know what sql query to write. So can someone help me. Really will appreciate.
回答1:
Here you go:
// change these IDs to match your customer and address
$customerId = 136;
$addressId = 92;
$customer = Mage::getModel('customer/customer')->load($customerId);
$address = $customer->getAddressById($addressId);
$address->setStreet('123 Main Street');
$address->setCity('Anytown');
$address->save();
If you need ways to obtain address IDs, please let me know what you are trying to accomplish and I can let you know the best way to do so.
来源:https://stackoverflow.com/questions/37185236/editing-customer-address-based-on-address-id-and-customer-id-in-magento