Friday 4 July 2014

How to Get Customer Default Shipping Detail Using Customer Id in Magento

If you know the customer id than direct use it other wise first you can get customer id than use that.

$customerId =2; // already known

Mage::getSingleton('customer/session')->loginById($customerId);
$customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping();
$address = Mage::getModel('customer/address')->load($customerAddressId);
$address_data = array (
            'prefix' => $address->getPrefix(),
            'firstname' => $address->getFirstname(),
            'lastname' => $address->getLastname(),
            'street' => $address->getStreet(),
'city' => $address->getCity(),
            'region_id' => $address->getRegionId(),
            'region' => $address->getRegion(),
            'postcode' => $address->getPostcode(),
            'country_id' => $address->getCountryId(),
            'telephone' => $address->getTelephone(),
            'email' => $address->getEmail()

);

No comments:

Post a Comment

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...