My package name is 'company' and my theme name is 'web', and I have another package named 'system' whose theme is named 'component'.
Run time is from the Block file but I want to set that theme and package from the front-end side in magento2.
If you want to Set package and theme at run time in magento simply use this code snippet.
create one function ex. changeTheme('Theme-name'); and run this function with your requirement
add this function in your head.phtml after php start.
function changeTheme($themeName)
{
Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
->setPackageName('default') //Name of Package
->setTheme($themeName); // Name of theme
}
enjoy :)
You can set your theme programmatically by using the following code :
Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
->setPackageName('default') //Name of Package
->setTheme('modern'); // Name of theme
http://roshanlal.in/magento/magento-programmatically-change-theme/#more-193
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With