Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Magento reads its configuration values at runtime directly from the configuration object's tree structure, so you need to use the configuration object's native <code>setNode</code> method to change the values. However, because of the way Magento <a href="http://alanstorm.com/category/magento#magento_config" rel="nofollow noreferrer">loads in scoped configuration</a> (self link), it's not as straight forward as it seems. </p> <p>With current versions of Magento (and I believe, but have not tested, with older versions), you'll need to set the configuration value in the set of nodes for the current <code>store</code>. </p> <p>Step one is getting the code for the currently set store. You can do this programmatically with the following</p> <pre><code>$store = Mage::app()-&gt;getStore(); $code = $store-&gt;getCode(); </code></pre> <p>then, you can set a configuration value with the following call</p> <pre><code>$config = Mage::getConfig(); $config-&gt;setNode("stores/$code/web/unsecure/base_skin_url", 'value_to_set'); </code></pre> <p>Keep in mind this all needs to happen <strong>after</strong> Magento has bootstrapped the configuration object. Also keep in mind there's a period of time where Magento will have a loaded configuration, but the store object will not be loaded. If this is the case you will not be able to load the store code from the store object.</p> <p>I did something similar in my <a href="http://alanstorm.com/magento_flat_collection_chaos" rel="nofollow noreferrer">Pulse Storm Chaos module</a>. If you're interested in working code it's on <a href="https://github.com/astorm/Pulsestorm/blob/master/app/code/community/Pulsestorm/Chaos/Model/Entropy.php" rel="nofollow noreferrer">Github</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload