3

When I save new value of a custom option in system config that new value is not available in the same request. For example, somewhere at the beginning of a controller action in a custom module I save the new value:

Mage::getConfig()->saveConfig('some/custom/option1', 'ABC');

And then at the end of that action when I try to get the value of this option from config:

$newValue = Mage::getStoreConfig('some/custom/option1');

it doesn't return ABC but the old value of this option. I understand it gets this old value from cached config.

Question: Is there a way to programmatically refresh/reload the system config to get the real last saved values from system config?

1 Answer 1

7

Try Mage::app()->getConfig()->reinit();

2
  • Thank you. Does this have any important side effects which I should know about before using it? :)
    – zitix
    May 27, 2014 at 16:06
  • @zitix afaik there is no side effect. This method invalidates the config cache and performs a complete reload of the configurations. The script runtime is of course longer.
    – Thorsten
    May 28, 2014 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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