2

I'm trying to get the header logo image and having some issues.. I keep getting the base/default package/theme instead of what is set as the package and theme for skin in the admin. Here is some code I've tried:

require 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::app()->loadArea('frontend');
$layout = Mage::getSingleton('core/layout');
$layout->getUpdate()->load('default');
$layout->generateXml()->generateBlocks();

//both of these are giving me base/default
echo $layout->getBlock('header')->getLogoSrc() . '<br/>';
echo Mage::getDesign()->getSkinUrl('images/logo.png');

I'm getting /skin/frontend/base/default/images/logo.png
But I'm expecting /skin/frontend/myPackage/myTheme/images/logo.png

In system config > Design, I have the "Current Package Name" set to "myPackage" (under Package), and Templates, Skin, and Layout set to "myTheme" (under Themes).

4

The problem here is likely this:

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

The current store is set to admin, which has the incorrect design package set.

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.