2015-01-21 137 views

回答

9

嘗試以下操作:

$value = "100"; 
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); 

OR

$resource = $this->getResourceModel(); 
$resource->saveConfig(rtrim('my/path/whatever', '/'), 1, 'default', 0); 
+0

是的,就是這樣,謝謝! – user4095519 2015-01-21 09:27:46

+0

這是否適用於任何配置設置?我在magento.exchange中有類似的問題:http://magento.stackexchange.com/questions/105634/how-to-export-import-features-settings-in-magento – Jurik 2016-03-14 15:28:16

0

帝國解決方案是正確的,但千萬記得之後清理緩存。所以使用類似

$value = "100"; 
Mage::getModel('core/config')->saveConfig('my/path/whatever', $value); 
Mage::getModel('core/config')->cleanCache(); 
相關問題