管理通知ツールバーをオーバーライドする方法
-
13-12-2019 - |
質問
現在拡張子を使用していて、通常はヘッダーの下に表示されている通知バーを上書きするためにいくつかのコードを追加したいと思います。私の小切手に基づいて、これを表示するファイルは...
/design/adminhtml/default/default/template/notification/toolbar.phtml
私は拡張子のレイアウトXMLファイルに次のコードを追加しましたが、機能しませんでした!
<reference name="notifications">
<action method="setTemplate">
<template>extension-folder/notification/toolbar.phtml</template>
</action>
</reference>
.
AdminNotification.xmlファイルをチェックして、このコードがあることに気づいた:
<layout>
<default>
<reference name="notifications">
<block type="adminhtml/notification_toolbar" name="notification_toolbar" as="notification_toolbar" acl="system/adminnotification/show_toolbar" template="notification/toolbar.phtml" />
</reference>
<reference name="notifications">
<block type="adminhtml/notification_window" name="notification_window" as="notification_window" acl="system/adminnotification/show_toolbar" template="notification/window.phtml" />
</reference>
</default>
</layout>
.
だから私はこのセクションをコピーすることにしました:
<reference name="notifications">
<block type="adminhtml/notification_toolbar" name="notification_toolbar" as="notification_toolbar" acl="system/adminnotification/show_toolbar" template="notification/toolbar.phtml" />
</reference>
.
拡張子のXMLファイルに貼り付けて、変更したテンプレートの場所でテンプレートセクションを変更します。これは、変更された通知ツールバーを表示していましたが、どういうわけか2インスタンスを表示しているとしてください。
誰もが支援することができますか?
解決
気にしないで、私は私が間違っていたことを考え出した!
使用していた参照名が正しくありませんでした。notifications
を使用する代わりに、notification_toolbar
admannotification.xmlに投稿したコードを見ると、同じ参照名の下に2ブロックがあります。その代わりにブロック名を使用することによって、これはXMLにオーバーライドしようとしている特定のブロックに問題を解決します。
所属していません magento.stackexchange