Override sales_order_grid.xml to remove print options from mass action drop down in sales orders
-
10-05-2021 - |
質問
Hello everyone,
I'm trying to override the file sales_order_grid.xml
to remove some print options from the mass action drop down in sales orders. I'm using Magento 2.4.2.
The original file is located here:
\vendor\magento\module-sales\view\adminhtml\ui_component\sales_order_grid.xml
- Where should I put the file to override it?
- Do I need to to create a module?
- Can I just make a copy of the file somewhere in my custom theme?
Thank you very much,
解決
You have to do in your custom module. Please follow below steps.
Step 1: In your custom module's module.xml file you have to write below code. Path :- PackageName/Module/etc/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="PackageName_Module" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales" />
</sequence>
</module>
</config>
Step 2: Create file sales_order_grid.xml file under PackageName/Module/view/adminhtml/ui_component/
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<listingToolbar name="listing_top">
<massaction name="listing_massaction">
<action name="pdfinvoices_order">
<settings>
<url path="sales/order/pdfinvoices"/>
<type>pdfinvoices_order</type>
<label translate="true">Print Invoices</label>
<actionDisable>true</actionDisable>
</settings>
</action>
<action name="pdfshipments_order">
<settings>
<url path="sales/order/pdfshipments"/>
<type>pdfshipments_order</type>
<label translate="true">Print Packing Slips</label>
<actionDisable>true</actionDisable>
</settings>
</action>
<action name="pdfcreditmemos_order">
<settings>
<url path="sales/order/pdfcreditmemos"/>
<type>pdfcreditmemos_order</type>
<label translate="true">Print Credit Memos</label>
<actionDisable>true</actionDisable>
</settings>
</action>
<action name="pdfdocs_order">
<settings>
<url path="sales/order/pdfdocs"/>
<type>pdfdocs_order</type>
<label translate="true">Print All</label>
<actionDisable>true</actionDisable>
</settings>
</action>
<action name="print_shipping_label">
<settings>
<url path="adminhtml/order_shipment/massPrintShippingLabel"/>
<type>print_shipping_label</type>
<label translate="true">Print Shipping Labels</label>
<actionDisable>true</actionDisable>
</settings>
</action>
</massaction>
</listingToolbar>
</listing>
As per above code you can remove all print actions from mass actions from sales > orders gird.
Output will be in my case :- https://prnt.sc/122pzpl
Please check and let me know if you have any query.
所属していません magento.stackexchange