1

I have my Magento package/theme structure configured like this:

In Configuration -> General -> Design:

In the package section the text "default". In the themes section I have all the inputs empty except for the default input where I have introduced the name of my theme: "mytheme".

I need to get the package && theme name by code.

I have no problems with the package name:

Mage::getDesign('core/design_package')->getPackageName()

This code returns "default", which is perfect.

But when I try to get the theme name, I cannot get the text "mytheme".

Mage::getDesign()->getTheme('frontend');
Mage::getDesign()->getTheme('layout');
Mage::getDesign()->getTheme('template');
Mage::getDesign()->getTheme('skin');
Mage::getDesign()->getTheme('locale');

The different approachs return always "default".

If I introduce and save the name of my theme for example in the "layout" input, I can get it with:

Mage::getDesign()->getTheme('layout');

But how I can get the text of the "default" input?

2

Try with

Mage::getStoreConfig('design/theme/template');
Mage::getStoreConfig('design/theme/layout');
Mage::getStoreConfig('design/theme/skin');
Mage::getStoreConfig('design/theme/locale');
Mage::getStoreConfig('design/theme/default');
0

Did you try :

Mage::getDesign()->getTheme('default');
  • Yep, it doesn't seem to be a valid option. The types array only contains "skin", "locale", "template" and "layout" options. – sh4 Jan 15 '16 at 8:45
  • I guess you can just do Mage::getStoreConfig('design/theme/default'); right ? – Raphael at Digital Pianism Jan 15 '16 at 9:20
  • Doesn't work either. Maybe could be because I'm executing it from an admin controller? (I set the area before). It also has a parent theme defined in theme.xml – sh4 Jan 15 '16 at 10:01
  • Try using your frontend store id as the second parameter of the getStoreConfig function. – Raphael at Digital Pianism Jan 15 '16 at 10:07
  • still not working from a custom admin controller although I can see it in the database with scope_id 0. I'm using this code: Mage::getStoreConfig('design/theme/default', Mage::app()->getStore()->getStoreId()) – sh4 Jan 15 '16 at 10:26
0

Try this

Mage::getStoreConfig('design/theme/default');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.