新しいmagentoテンプレートを設定するために常に使用されていたObserverクラスがあります。
<?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>
私はこれを持っています。インストール中に作成されたメイン管理者ユーザーに対しては正常に機能します。
現在、ログインして製品のみを追加できる多くの管理者ユーザーがいますが、何らかの理由で、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)
}
注: 私のスキン/フォルダーは、新しい mage 管理者用に css を変更しました。テンプレート フォルダーには、余分な css を読み込むための page/head.phtml しかありません。
管理者/カタログ ユーザーに同じテンプレートを表示できない理由を教えてください。