Magento – Adding additional store addresses

Magento allows you to define 5 email addresses in backoffice, to add some, create (or use an existing) system.xml in a new (or existing) module like this

<config>
    <sections>
        <trans_email>
            <groups>
                <ident_relance translate="label">
                    <label>Relances</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <email translate="label">
                            <label>Sender Email</label>
                            <frontend_type>text</frontend_type>
                            <backend_model>adminhtml/system_config_backend_email_address</backend_model>
                            <validate>validate-email</validate>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </email>
                        <name translate="label">
                            <label>Sender Name</label>
                            <frontend_type>text</frontend_type>
                            <backend_model>adminhtml/system_config_backend_email_sender</backend_model>
                            <validate>validate-emailSender</validate>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </name>
                    </fields>
                </ident_relance>
            </groups>
        </trans_email>
    </sections>
</config>

In this case, this will create 2 entries in the core_config_data table : trans_email/ident_relance/email and trans_email/ident_relance/name.

To retrieve values, use this :

Mage::getStoreConfig('trans_email/ident_relance/email');
Mage::getStoreConfig('trans_email/ident_relance/name');

Magento using core_config_data table

Core_config_data is a magento table used to save configuration and setting. It’s really helpfull and easy to use :

save or update a new entry :

$data = new Mage_Core_Model_Config();
$data->saveConfig('adin/ssid', 'value', 'default', 0);

and retrieve saved value :

$value = Mage::getConfig()->getNode('default/adin/ssid');

You may need to specify scope and scope code to retrieve the value

$value = Mage::getConfig()->getNode('default/sogen/file_number', 'default', 0 );

Update or create a value inside the installer (data, no sql)

  $installer->setConfigData('customer/address/prefix_show', 0);