Display your Magento store address (from the configuration)

Jun 6, 2011

Magento: store addressMagento lets you enter your store address directly into the configuration settings – here is the code snippet to display that in one of your Magento Templates.

First of all the setting is found in the system-Configuration page under General – Shop Information. Obviously you can vary this for different Store Views etc. Here is a quick screenshot to make sure you are in the right place…

echo Mage::getStoreConfig('general/store_information/address');

You probably want to display on multiple lines – by default this will just include line breaks that will then be ignored in HTML. To sort that out you want to use the PHP function nl2br. Which leaves your code like this…

echo nl2br(Mage::getStoreConfig('general/store_information/address'));

And finally a quick summary of nl2br – a very useful function that I always forget about.


(PHP 4, PHP 5)

nl2br — Inserts HTML line breaks before all newlines in a string


string nl2br ( string $string [, bool $is_xhtml = true ] )

Returns string with
inserted before all newlines (\r\n, \n\r, \n and \r).


string – The input string.

is_xhtml – Whenever to use XHTML compatible line breaks or not.

Return Values

Returns the altered string.