Login:
Password:
Remember password Show my name in the online users list
Forgot password?
I’m using following code to get a information for customer
$session = Mage::getSingleton('customer/session$address = $session->getCustomer()->getAddresses(); $customer = $session->getCustomer();$customerData['street] = $address[$i]->street;
but my problem is I am getting street 1 and street2 added I want that to be separated so what object and what function need to call to get these street separated.
pls help as I got stuck by this prob. as I can’t even explode these street addresses.
“God is Real, Unless declared Integer ”
I’m not sure, but you could try this:
$i = 0;foreach ($address as $a) { $customerData['street'.$i] = $a->getStreet(); $i++;}
“Perfection can only be achieved within the frames of imperfection”
thanks for your reply but it is not working as I wanted to find a object of address so that I can find two streets
Well, I’m not sure what you are seeking mate. But here is something which might help you:
$session = Mage::getSingleton('customer/session');$addresses = $session->getCustomer()->getAddresses();foreach ($session->getCustomer()->getAddresses() as $address) { echo $address->getData('postcode');}
And I’ve checked that code, it works . At least in verison 1.1.8. You could also use this:
$session = Mage::getSingleton('customer/session');$addresses = $session->getCustomer()->getAddresses();foreach ($session->getCustomer()->getAddresses() as $address) { echo $address->getOrigData('postcode');}
The address object contains two sets of addresses, called _origData and _data. If you need more information try using this:
$session = Mage::getSingleton('customer/session');$addresses = $session->getCustomer()->getAddresses();echo '<pre>';die(print_r($addresses));
Hope it helps , and happy christmas!
Thanks for your reply, I got my solution for spliting street addresses of customer at checkout here I’m giving what I use to get a splited addresses :
$customerData = array();$checkaddress=array();$addressArrayObj = Mage::getModel('paypal/standard');$checkaddress = $addressArrayObj->getStandardCheckoutFormFields(); //returns array of customer information with separated street addresses$customerData['street1'] = $checkaddress['address1']; $customerData['street2'] = $checkaddress['address2'];