So i have a dropdown i created that fires a request to change a theme by saving the selected theme in the current session. I set up an event/observer that changes the theme based on that session variable:
<events>
<controller_action_layout_generate_blocks_before>
<observers>
<themesplayground>
<type>singleton</type>
<class>Rusman_ThemesPlayground_Model_Observer</class>
<method>switchTheme</method>
</themesplayground>
</observers>
</controller_action_layout_generate_blocks_before>
</events>
And here is observer method:
public function switchTheme($observer){
Mage::log(__METHOD__,null,null,true);
if( Mage::getSingleton('core/session')->getCurrentTheme() ){
Mage::log(Mage::getSingleton('core/session')->getCurrentTheme(),null,null,true);
foreach (array('layout', 'template', 'skin', 'locale') as $type) {
Mage::getDesign()->setTheme($type, Mage::getSingleton('core/session')->getCurrentTheme());
}
}
}
The set up above works for the template files just fine, but the xml layout files(i only have local.xml for now) for the new theme don't seem to be getting loaded in. Is there another event i should observing? Or am i forgetting to update something?