我想在自定义脚本中加载客户地址集合。
此代码仅加载帐单邮寄地址,但我需要加载所有地址(我在此客户下有3个地址)
$customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
if ($customerAddressId){
$address = Mage::getModel('customer/address')->load($customerAddressId);
// echo "<pre>"; print_r($address->getData());echo "</pre>";
Zend_Debug::dump($address->debug());
$street = $address->getData('street');
}
试过这个,但这不是退回送货地址。
Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
请帮我为特定用户加载Magento客户表中的所有地址。
答案 0 :(得分:10)
你尝试过这样做吗?
$customer = Mage::getSingleton('customer/session')->getCustomer();
foreach ($customer->getAddresses() as $address) {
Zend_Debug::dump($address->debug());
}