我有一個Observer類,我總是用它來設置新的magento模板。Magento Admin自定義主題不起作用
<?php
class Company_Customadmintheme_Controller_Observer
{
public function overrideAdminTheme()
{
//if(Mage::getStoreConfig('design/admin/enable_admin_custom_theme') == 1)
Mage::getDesign()->setArea('adminhtml')->setTheme('custom');
}
}
,並在我的配置XML
<?xml version="1.0"?>
<config>
<global>
<models>
<comapnycustomadminthemecontroller>
<class>Comapny_Customadmintheme_Controller</class>
</comapnycustomadminthemecontroller>
</models>
<events>
<adminhtml_controller_action_predispatch_start>
<observers>
<comapny_adminthemeoverride_observer>
<type>singleton</type>
<class>Comapny_Customadmintheme_Controller_Observer</class>
<method>overrideAdminTheme</method>
</comapny_adminthemeoverride_observer>
</observers>
</adminhtml_controller_action_predispatch_start>
</events>
</global>
</config>
我有這個。它適用於安裝時創建的主管理員用戶。
現在我們有許多管理員用戶將能夠登錄和添加products.But由於某種原因,它仍然顯示magento默認模板/皮膚,而不是選擇自定義模板(仍然在主管理員用戶誰可以訪問所有模塊/配置)。
因此,爲了使目錄用戶也看到相同的模板,我應該需要在XML中指定任何東西。
在觀察者類,當我試圖看到當前模板/皮膚仍然我看到下面的數組爲兩個用戶。
object(Mage_Core_Model_Design_Package)#92 (8) {
["_store:protected"] => NULL
["_area:protected"] => string(9) "adminhtml"
["_name:protected"] => string(7) "default"
["_theme:protected"] => array(4) {
["layout"] => string(6) "custom"
["template"] => string(6) "custom"
["skin"] => string(6) "custom"
["locale"] => string(6) "custom"
}
["_rootDir:protected"] => NULL
["_callbackFileDir:protected"] => NULL
["_config:protected"] => NULL
["_shouldFallback:protected"] => bool(true)
}
注: 我的皮膚/文件夾中有體改新法師管理員和模板文件夾CSS只有頁/ head.phtml加載額外的CSS。
請有人可以幫助我爲什麼無法看到管理員/目錄用戶相同的模板。
剛猜測,它可能與商店有關。你是否試圖指定商店ID? – 2012-03-07 12:18:22
你好OSdave,問題是什麼問題? – Elamurugan 2012-03-08 14:41:21
嗨Oğuz,甚至刪除條件檢查時沒有任何反應。查看我更新的代碼。 – Elamurugan 2012-03-08 14:42:55