Before saying this post is a duplicate please read.
I have a real head scratcher for you. I am trying to get the current package name being used. In a clean install with 1.9, the current package name is rwd
. However, all methods that I have tried return the value default
. I find this very odd and wonder if anyone else has faced this problem?
I have tried the following: (please note that I have looked through as many exchange posts that I could find relating to getting this info with no luck.
https://stackoverflow.com/questions/11155570/how-to-get-current-theme-name-in-magento
Mage::getSingleton('core/design_package')->getPackageName()
Mage::getDesign()->getPackageName()
Mage::getDesign()->getPackageName('frontend')
Mage::getDesign()->getTheme('frontend')
and
Mage::getDesign()->getDefaultTheme()
Mage::getStoreConfig('design/package/name');
Mage::app()->getStore()->getStoreId();
Mage::getStoreConfig('design/package/name', $storeId);
All of these methods return default
which is not correct. I noticed that during a fresh 1.9 install the default package name is rwd
. However, design/package/name
does not exist in core_config_data
table unless you save the configurations in the backend.
So, why does Magento return default
even if the path does not yet exist in the table? Also, when it does exist and contains rwd
as the package name, why does it still return default
??
Update:
I should mention that I am trying to retrieve this info from the backend. It appears it will pull the right info if you are trying to retrieve it from the frontend only.
Best Answer
Joe78,
I put this:
At the bottom of the footer.phtml file in
magento/app/design/frontend/rwd/default/template/page/html
(before even running the installer) on a fresh unpack of 1.9.As soon as I loaded the frontend up I found
string 'rwd' (length=3)
in my site's footer.I believe what package you have returned is going to depend on where exactly you put the package call. Also the following:
should in-fact return "default" on a vanilla 1.9 install as you're using magento/app/design/frontend/rwd/default as your theme.
For more info or to dive into how core/design_package is structured simply add the following to a template file:
The response you get should start out with something like:
For a little more insight into how exactly design/package fallback works in 1.9 take a gander at the files in
magento/app/code/core/Mage/Core/Model/Design
Hope this helps!