Call-back icon  Enterprise Sales: +1.310.775.2674 (N. America)   +44 20.3286.4137 (UK)

Magento

eCommerce Software for Online Growth

Magento Forum

   
spliting two street addresses
 
pankajk
Member
 
Avatar
Total Posts:  37
Joined:  2008-04-15
Mumbai -101, Maharastra, India
 

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.

 Signature 

“God is Real, Unless declared Integersmile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bockbertil
Sr. Member
 
Total Posts:  244
Joined:  2007-11-18
 

I’m not sure, but you could try this:

$i 0;
foreach (
$address as $a{
    $customerData[
'street'.$i] $a->getStreet();
    
$i++;
}

 Signature 

“Perfection can only be achieved within the frames of imperfection”

 
Magento Community Magento Community
Magento Community
Magento Community
 
pankajk
Member
 
Avatar
Total Posts:  37
Joined:  2008-04-15
Mumbai -101, Maharastra, India
 

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

 Signature 

“God is Real, Unless declared Integersmile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bockbertil
Sr. Member
 
Total Posts:  244
Joined:  2007-11-18
 

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 wink. 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 smile, and happy christmas!

 Signature 

“Perfection can only be achieved within the frames of imperfection”

 
Magento Community Magento Community
Magento Community
Magento Community
 
pankajk
Member
 
Avatar
Total Posts:  37
Joined:  2008-04-15
Mumbai -101, Maharastra, India
 

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'];

 Signature 

“God is Real, Unless declared Integersmile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2009 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
108783 users|292 users currently online|199900 forum posts