Magento2自定义xml文件

magento 2中的自定义布局文件覆盖系统主题布局文件

1.创建了一个自定义模块xml文件

app/code/Learning/RewriteSales/view/adminhtml/layout/sales_order_view.xml

系统文件位置

vendor/magento/module-sales/view/adminhtml/layout/sales_order_view.xml

2.在module.xml文件中声明核心模块的依赖关系

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Modulename" setup_version="1.0.0" active="true">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>

注:你的文件里面,你只需要保留只需要的代码就可以在xml文件的body标签中使用自定义布局文件;

3.清除缓存

bin/magento cache:clean

参考地址: https://magento.stackexchange.com/questions/140626/how-can-i-override-this-vendor-layout-file-with-my-custom-layout-file-in-magento

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章