Please explain me what is the difference of
$this->getConfigData('xyz')
and Mage::getStoreConfig('abc/xyz/hfc')
.
What is the difference of both function.
When you use Mage::getStoreConfig('abc/xyz/hfc')
then you need to pass section name, tab name & field Name. so It will fetch value for that field.
But If Suppose you have payment module and you have more then 100 Fields so each time you can not give whole path. In your Module you can create one method like as below. so you need to just pass the key and it will create path using function.
public function getConfigData($key)
{
return Mage::getStoreConfig("catalog/custom_options/$key");
}
It it's very easy for you to identify.
In Magento Release Notes
They also mention this Line Made fetching payment methods sort order properly: via getConfigData() rather getStoreConfig() (optimization for 3rd-party customizations).
Mage::getStoreConfig()
use to store specific field at system input admin.
getStoreConfig(),
Magento gets a reference to an instance of the specific store object.
getStore returns an instance of the current store object
.
see at http://alanstorm.com/magento_loading_config_variables
https://stackoverflow.com/questions/5892476/how-to-get-data-from-magento-system-configuration
https://stackoverflow.com/questions/19941411/magento-getstoreconfig-multistore
And getConfigData()
function of Current Class which general give current store configuration value
Adding to Keyul Shah's Answer: The values you can get in Mage::getStoreConfig('abc/xyz/hfc') are saved in core_config_data table of magento DB. Before this function can return anything, there has to be an entry in 'path' column of core_config_data table. There is a column for store_id as well in core_config_data. If no store id is passed as an argument, default store id 0, which belongs to admin, will be taken up.
public function getConfigData($key) { return Mage::getStoreConfig("catalog/custom_options/$key"); }
I have removed the above code from html.php file. Do I need to check any other code or database after removing the code.