문제

현재 확장 프로그램을 사용하고 있으며 일반적으로 헤더 아래에 표시되는 알림 표시줄을 재정의하기 위해 일부 코드를 추가하고 싶습니다.내 확인에 따르면 이를 표시하는 파일은 다음과 같습니다.

/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

내가 adminnotification.xml에 게시한 코드를 보면 동일한 참조 이름 아래에 2개의 블록이 있습니다.대신 블록 이름을 사용하면 내가 재정의하려는 특정 블록을 xml에 알려주므로 문제가 해결됩니다!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top