Last active
August 29, 2015 13:59
-
-
Save benmarks/10873407 to your computer and use it in GitHub Desktop.
Basic data setup script for migrating config settings using store code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @var $installer Mage_Core_Model_Resource_Setup */ | |
/* @var $storeObj Mage_Core_Model_Store */ | |
$installer = Mage::getResourceModel('core/setup','core_setup'); | |
foreach (Mage::app()->getStores(false,true) as $storeCode => $storeObj) { | |
switch($storeCode){ | |
case 'somecode': | |
$path = 'design/theme/default'; //or one of design/theme/{layout|locale|skin|template} | |
$value = 'theme_name'; | |
break; | |
case 'anothercode': | |
$path = 'design/theme/default'; | |
$value = 'another_theme_name'; | |
break; | |
//... | |
} | |
//write to DB | |
$installer->setConfigData( | |
$path, | |
$value, | |
'stores', | |
$storeObj->getId() | |
); | |
//Log query | |
Mage::log( | |
$storeCode.': '.$value, | |
Zend_Log::INFO, | |
'theme-setup.log', | |
true | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment