$customerId = 2;
$customer = Mage::getModel('customer/customer')->load($customerId);
$defaultBilling = $customer->getDefaultBilling();
$defaultShipping = $customer->getDefaultShipping();
$allAddress = Mage::getModel('customer/address')->getCollection()->setCustomerFilter($customer);
foreach ($allAddress as $address) {
if($defaultBilling == $address->getId()) {
// its customer default billing address
} else if($defaultShipping == $address->getId()) {
// its customer default shipping address
} else {
// its customer other address that saved
}
}
$customer = Mage::getModel('customer/customer')->load($customerId);
$defaultBilling = $customer->getDefaultBilling();
$defaultShipping = $customer->getDefaultShipping();
$allAddress = Mage::getModel('customer/address')->getCollection()->setCustomerFilter($customer);
foreach ($allAddress as $address) {
if($defaultBilling == $address->getId()) {
// its customer default billing address
} else if($defaultShipping == $address->getId()) {
// its customer default shipping address
} else {
// its customer other address that saved
}
}
No comments:
Post a Comment