Editing customer address based on address id and customer id in magento

半城伤御伤魂 提交于 2019-12-13 07:29:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!