Answers:
使用时,Mage::getStoreConfig('abc/xyz/hfc')
您需要传递节名称,选项卡名称和字段名称。因此它将获取该字段的值。
但是,如果假设您有付款模块并且您有100多个字段,那么每次您都无法给出完整的路径。在模块中,您可以创建一种如下所示的方法。所以您只需要传递密钥,它将使用函数创建路径。
public function getConfigData($key)
{
return Mage::getStoreConfig("catalog/custom_options/$key");
}
您很容易识别。
在Magento中,Release Notes
他们也提到这条线Made fetching payment methods sort order properly: via getConfigData() rather getStoreConfig() (optimization for 3rd-party customizations).
Mage::getStoreConfig()
用于在系统输入admin处存储特定字段。
getStoreConfig(),
Magento获取对特定商店对象实例的引用。getStore返回an instance of the current store object
。
参见http://alanstorm.com/magento_loading_config_variables
/programming/5892476/how-to-get-data-from-magento-system-configuration
/programming/19941411/magento-getstoreconfig-multistore
和getConfigData()
一般给出的Current Class的功能current store configuration value
添加到Keyul Shah的答案中:您可以在Mage :: getStoreConfig('abc / xyz / hfc')中获取的值保存在magento DB的core_config_data表中。在此函数可以返回任何内容之前,必须在core_config_data表的'path'列中有一个条目。在core_config_data中也有一个针对store_id的列。如果没有将商店ID作为参数传递,则将使用属于admin的默认商店ID 0。
公共函数getConfigData($ key){返回Mage :: getStoreConfig(“ catalog / custom_options / $ key”); }
我已经从html.php文件中删除了上面的代码。删除代码后是否需要检查其他任何代码或数据库。