Pergunta

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).

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top