1

I have the need of the installed module has a single reference to query a webservice that returns the records of your reference.

I have this reference currently saved in a database table working properly, but I think unnecessary only 1 record in the table to contain the reference.

I was wondering if there are other ways to save this reference on Magento, per file, or some table of database of Magento, so I can delete this table with a single record.

1 Answer 1

2

In your module config.xml file add following code inside <config> node:

<default>
    <your_module>
        <settings>
            <service_url><![CDATA[http://www.example.com/]]></service_url>
        </settings>
    </your_module>
</default>

To retrieve the value use:

$serviceUrl = Mage::getStoreConfig('your_module/settings/service_url');

You can save your value to database like this:

Mage::getConfig()->saveConfig('your_module/settings/service_url', 'Your data');

Your data will be saved in core_config_data table. If you call Mage::getStoreConfig() now data from database will be returned instead of the one defined in config.xml because database is loaded last it will 'overwrite' the value in config.xml`

3
  • Even if it would work, I would need to pass a method within the '<service_url> </ service_url>', so to exclude the module loses the reference, and the database does not lose = /
    – Dexxtz
    Dec 30, 2014 at 19:53
  • I edited the answer. Dec 30, 2014 at 20:16
  • Nice, thank you =D
    – Dexxtz
    Jan 2, 2015 at 14:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.