Using magento configuration data
The previous post looked at how to add configuration variables to Magento. This Post will show how to set and use the variables.
The naming convention for variables is the path through the xml, section/group/form. So the url variable from the previous post is shipping/mydispatch/url.
The function to retireve the value of the variable is
Mage::getStoreConfig(’shipping/mydispatch/url’)
for a specific store use
Mage::getStoreConfig(’shipping/mydispatch/url’,x)
Where x is id of the store
The default variables can also be set in the config.xml file for your module. For example to set default test values for the mydispatch module one can use the following
<config> <default> <shipping> <mydispatch> <url>test.mydispatch.com/testsystem</url> <user>Tester1</user> <secret>Password1</secret> </mydispatch> </shipping> </default> </config>
2 Responses Leave a comment
Thanks
Hello,
I’m trying to create an extra input field called “sample-xml-path” on simple products but I’m having trouble with the name of the module. You use shipping in your example – would you know the name for doing this with a simple product?
I’m getting to grips with Magento but it’s hard to find the files you want sometimes!
Thanks,
Chris