Hướng dẫn thay đổi Logo mặc định trong Admin Panel Magento 2

Theo mặc định, bảng điều khiển admin hiển thị logo của Magento 2 trên trang đăng nhập và thanh menu. Thay đổi logo thành doanh nghiệp của bạn sẽ làm tăng tính cá nhân hóa cho cửa hàng. Tuy nhiên, sẽ không thể thay đổi bằng cách thiết lập trong trang admin, mà phải can thiệp đến code. Trong bài viết này mình sẽ hướng dẫn bạn cách thay đổi Logo mặc định trong Admin Panel Magento 2.

Thay đổi logo trên trang admin Magento 2

Chúng ta sẽ cùng tìm hiểu về cách thay đổi logo ở hai nơi trong Admin Panel là trang đăng nhập và thanh menu.

Thay logo trang đăng nhập(Login)

logo mặc định trang đăng nhập Magento 2

Bước 1: Copy logo cần đổi vào đường dẫn vendor\magento\theme-adminhtml-backend\web\images\.

Bước 2: Tạo file admin_login.xml theo đường dẫn trong một module của bạn: app\code\Vendor\Extension\view\adminhtml\layout\

Và có đoạn code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-login" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_image_src" xsi:type="string">images/ten-anh-logo.png</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

Thay logo thanh menu

logo thanh menu mặc định - thay đổi logo menu admin Magento 2

Bước 1: Tương tự như trên, bạn copy ảnh logo vào vendor\magento\theme-adminhtml-backend\web\images\.

Bước 2: Tạo file default.xml theo đường dẫn view/adminhtml/layout/ trong module của bạn.

Trong file có code như sau:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="header">
            <block class="Magento\Backend\Block\Page\Header" name="logo" before="-">
                <arguments>
                    <argument name="show_part" xsi:type="string">logo</argument>
                    <argument name="edition" translate="true" xsi:type="string">Community Edition</argument>
                    <argument name="logo_image_src" xsi:type="string">images/ten-anh-logo.png</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>

Như vậy là mình đã hướng dẫn xong cách thay đổi Logo mặc định trong Admin Panel Magento 2.

Cảm ơn bạn đã đọc bài viết.

Xem thêm loạt bài Hướng dẫn Magento 2.

4.5 2 votes
Article Rating

Callula Huy

Callula is the Marketing Executive at Magetop. With more than 5 years of copywriting under her belt, Callula is into creating valuable content that is straight to the point. Life student. Workaholic. Foreign languages and traveling aficionado.

Leave a Reply or put your Question here

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x