1

私は Magento を初めて使用し、Magento バックエンドの顧客ビューに新しいタブを追加しようとしています。

そのための新しい拡張/モジュールを作成しました。以下は、私の etc/config.xml の抜粋です。

<global>
    <blocks>
        <showidea>
            <class>Whatever_Extendcustomer_Block</class>
        </showidea>
    </blocks>
    <!-- ... -->
</global>
<adminhtml>
    <layout>
        <updates>
            <showidea>
                <file>whatever_extendcustomer.xml</file>
            </showidea>
        </updates>
    </layout>
</adminhtml>

そして、whatever_extendcustomer.xml ファイルの内容は次のとおりです。

<adminhtml_customer_edit>
    <reference name="customer_edit_tabs">
        <action method="addTab">
            <name>extendcustomer_showidea</name>
            <block>extendcustomer/adminhtml_customer_showidea</block>
        </action>
    </reference>
</adminhtml_customer_edit>

もちろん、このブロックは存在し、 Mage_Adminhtml_Block_Template を拡張してMage_Adminhtml_Block_Widget_Tab_Interfaceを実装します

顧客の詳細に移動すると、次のエラーが表示されます: タブの設定が間違っています。Magento のエラー ログには次のように表示されます。

/var/www/vhosts/whatever/htdocs/app/Mage.php:594 にメッセージ「Invalid Blocktype: Mage_Extendcustomer_Block_Adminhtml_Customer_Showidea」を含む例外「Mage_Core_Exception」が発生する

Mage_Extendcustomer が間違っているため、これが問題だと思います。それはWhatever_である必要があります...しかし、Whatever_名前空間の代わりにMage_を先頭に追加する理由がわかりません。

誰かが私に手がかりを教えてくれることを願っています!ありがとう。

4

1 に答える 1

5

レイアウト ファイルshowideaの代わりに使用する必要があります。extendcustomer

<adminhtml_customer_edit>
    <reference name="customer_edit_tabs">
        <action method="addTab">
            <name>extendcustomer_showidea</name>
            <block>showidea/adminhtml_customer_showidea</block>
        </action>
    </reference>
</adminhtml_customer_edit>

これは、ブロック構成で定義したものであるためです。

<blocks>
    <showidea>
        <class>Whatever_Extendcustomer_Block</class>
    </showidea>
</blocks>
于 2012-07-16T12:03:53.963 に答える