Showing results for 
Search instead for 
Did you mean: 

Two-Line Address Separator

Two-Line Address Separator

I need to pull a custom address out of the database from outside of Magento, and need to break the street address into two lines. In the database it is store as two lines but when I pull it out and print it, it prints cramed together like this:


1234 M StreetApartment 54


What newline character is it using?


I have tried explode("/n", $address) and just to ee if I could recognize the character I did str_replace("/n", "abcd", $address) and even tried chr(13) and chr(10) and none of it works. 


What character does Magento use to separate out the address into two lines?


Re: Two-Line Address Separator

Hi @semboku,

I don't have a working sample but I guess if you have a Customer Address object you should be able to ->getStreetLine($line_number) or ->explodeStreetAddress() to get an array with all the lines.

If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"