×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Roman Ignatov
Added: Nov 22, 2016 4:49 PM
Views: 9
Tags: magento
Original post: http://gielberkers.com/change-magento-configuration-fly/
Sometimes you have a situation where you need to change the configuration of Magento on the fly. Just for your single request, without saving it. This can be easily done with the Magento configuration Model:
  1. <?php
  2.  
  3. // temporary replace GLOBAL configuration value:
  4. Mage::getConfig()->setNode('path/to/config/node', 'my_temporary_value');
  5.  
  6.  
  7. // Temporary change STORE configuration setting:
  8. Mage::app()->getStore()->setConfig('path/to/setting', 'temp-value');