1

新しい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 しかありません。

管理者/カタログ ユーザーに同じテンプレートを表示できない理由を教えてください。

4

2 に答える 2

2

これは、Backoffice でカスタム テーマを使用する正しい方法ではありません。

Magento はすでにこれを実装しています。これを任意の config.xml (app/etc または任意のカスタム モジュールにあるもの) に入れるだけです。

<?xml version="1.0" encoding="UTF-8"?>
<config>
   <stores>
      <admin>
         <design>
            <theme>
               <default>custom</default>
            </theme>
         </design>
      </admin>
   </stores>
</config> 

これにより、Magento は、app/design/adminhtml/default/default でフェールオーバーを使用して app/design/adminhtml/default/custom でデザイン テンプレートを検索し、スキンでフェールオーバーを使用して skin/adminhtml/default/custom でデザイン リソースを検索します。 /adminhtml/デフォルト/デフォルト

于 2012-04-10T13:50:56.043 に答える
0

修正しました!

問題はシステム > 構成 > デザインではありませんでしたが、実際にはシステム > デザインシステム > デザインがデフォルト/ショッパー用に設定されており、その時間枠がありませんでした。次のリンクは、私の結論に到達するのに役立ちました。

http://www.magentocommerce.com/boards/viewthread/197908/

一時的なテーマの変更にはシステム > デザインが必要ですが、私のサイトには時間枠が設定されていないため、システム > 構成 > デザインの設定が常に上書きされます

于 2013-11-04T17:16:31.177 に答える